Patchwork lookup create with O_EXCL patch merged

login
register
mail settings
Submitter Steve French
Date July 8, 2009, 9:58 p.m.
Message ID <524f69650907081458y6b6301e0mc2340f0f8a36b8bc@mail.gmail.com>
Download mbox | patch
Permalink /patch/29609/
State New
Headers show

Comments

Steve French - July 8, 2009, 9:58 p.m.
Now that it has been tested by Shirish, merged Jeff's patch into cifs-2.6.git

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>
CC: Stable Kernel <stable@kernel.org>
---

 	in which we already have the sb rename sem */
Wilhelm Meier - July 9, 2009, 8:13 p.m.
Am Mittwoch, 8. Juli 2009 23:58:27 schrieb Steve French:
> Now that it has been tested by Shirish, merged Jeff's patch into
> cifs-2.6.git
>
> cifs: fix regression with O_EXCL creates and optimize away lookup

ok, works perfectly for me (tested together with samba-3.3.6)!

Thanks,

Wilhelm

>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> Tested-by: Shirish Pargaonkar <shirishp@gmail.com>
> CC: Stable Kernel <stable@kernel.org>
> ---
>
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index a40054f..ff55fc6 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -643,6 +643,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 */

Patch

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index a40054f..ff55fc6 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -643,6 +643,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)