From 0df1a34ae0b754a8a99d6a2b32637dd3c37108e2 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 1 Jul 2013 12:26:15 -0500 Subject: [PATCH] LU-3517 llite: don't check for O_CREAT in it_create_mode 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 and do the same in llu_lookup_it(). 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. Signed-off-by: John L. Hammond Change-Id: I301964222ec043e6f0cc3b000678fe3c881a2381 Reviewed-on: http://review.whamcloud.com/6786 Reviewed-by: Lai Siyao Reviewed-by: Peng Tao Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/liblustre/namei.c | 12 +++++------- lustre/llite/namei.c | 11 +++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 0e72637..a3d6d6e 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -432,13 +432,11 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode, icbd.icbd_child = pnode; icbd.icbd_parent = parent; - if (it->it_op & IT_CREAT || - (it->it_op & IT_OPEN && it->it_create_mode & O_CREAT)) { - opc = LUSTRE_OPC_CREATE; - } else { - opc = LUSTRE_OPC_ANY; - } - + if (it->it_op & IT_CREAT) + opc = LUSTRE_OPC_CREATE; + else + opc = LUSTRE_OPC_ANY; + llu_prep_md_op_data(&op_data, parent, NULL, pnode->p_base->pb_name.name, pnode->p_base->pb_name.len, flags, opc); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 81bf255..857c4508 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -529,11 +529,10 @@ 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)) - opc = LUSTRE_OPC_CREATE; - else - opc = LUSTRE_OPC_ANY; + if (it->it_op & IT_CREAT) + opc = LUSTRE_OPC_CREATE; + else + opc = LUSTRE_OPC_ANY; op_data = ll_prep_md_op_data(NULL, parent, NULL, dentry->d_name.name, dentry->d_name.len, lookup_flags, opc, @@ -631,7 +630,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; } -- 1.8.3.1