Re: lookup create with O_EXCL patch merged

Wilhelm Meier <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
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 <[email protected]>
> Tested-by: Shirish Pargaonkar <[email protected]>
> CC: Stable Kernel <[email protected]>
> ---
>
> 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 */

-- 
Wilhelm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.