blob: e5f99ee7629f18b10d03ed89cefa545330a1e688 [file] [log] [blame]
From 5ddf1e0ff00fd808c048d0b920784828276cc516 Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@redhat.com>
Date: Sun, 5 Jul 2009 11:01:02 -0400
Subject: cifs: fix regression with O_EXCL creates and optimize away lookup
From: Jeff Layton <jlayton@redhat.com>
commit 5ddf1e0ff00fd808c048d0b920784828276cc516 upstream.
cifs: fix regression with O_EXCL creates and optimize away lookup
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Tested-by: Shirish Pargaonkar <shirishp@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/cifs/dir.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -641,6 +641,15 @@ cifs_lookup(struct inode *parent_dir_ino
}
}
+ /*
+ * 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 */