]> Pileus Git - ~andy/linux/commitdiff
staging/lustre/llite: don't check for O_CREAT in it_create_mode
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 3 Dec 2013 13:58:45 +0000 (21:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Dec 2013 16:45:29 +0000 (08:45 -0800)
ll_lookup_it() checks for O_CREAT in struct lookup_intent's
it_create_mode member which is nonsensical, as it_create_mode is used
for file mode bits (S_IFREG, S_IRUSR, ...). Fix this by just checking
for IT_CREATE in it_op. This will not affect the behavior of either
function, since if O_CREATE (0100) is actually set in o_create_mode
then IT_CREATE must have been set in it_op. In ll_atomic_open() check
for O_CREAT in the open_flags parameter rather than testing mode.

Lustre-change: http://review.whamcloud.com/6786
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3517
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/namei.c

index 804451fabfbf39dce069b3159973b9b47274edae..52422338a666e4153776d1591eb33634bd0d022c 100644 (file)
@@ -523,8 +523,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
        icbd.icbd_childp = &dentry;
        icbd.icbd_parent = parent;
 
-       if (it->it_op & IT_CREAT ||
-           (it->it_op & IT_OPEN && it->it_create_mode & O_CREAT))
+       if (it->it_op & IT_CREAT)
                opc = LUSTRE_OPC_CREATE;
        else
                opc = LUSTRE_OPC_ANY;
@@ -623,7 +622,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
                return -ENOMEM;
 
        it->it_op = IT_OPEN;
-       if (mode) {
+       if (open_flags & O_CREAT) {
                it->it_op |= IT_CREAT;
                lookup_flags |= LOOKUP_CREATE;
        }