From: Jeff Layton Date: Sun, 5 Jul 2009 15:01:02 +0000 (-0400) Subject: cifs: fix regression with O_EXCL creates and optimize away lookup X-Git-Tag: v2.6.30.4~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d33821d65cdad2af0461f3a6268125cc8a33052;p=thirdparty%2Fkernel%2Fstable.git cifs: fix regression with O_EXCL creates and optimize away lookup commit 5ddf1e0ff00fd808c048d0b920784828276cc516 upstream. cifs: fix regression with O_EXCL creates and optimize away lookup Signed-off-by: Jeff Layton Tested-by: Shirish Pargaonkar Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3758965d73d56..83440ca44c039 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -641,6 +641,15 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, } } + /* + * O_EXCL: optimize away the lookup, but don't hash the dentry. Let + * the VFS handle the create. + */ + if (nd->flags & LOOKUP_EXCL) { + d_instantiate(direntry, NULL); + return 0; + } + /* can not grab the rename sem here since it would deadlock in the cases (beginning of sys_rename itself) in which we already have the sb rename sem */