Re: [PATCH] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  7 Aug 2013 09:04:07 -0400
Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> David reported that commit c2b93e06 (cifs: only set ops for inodes in
> I_NEW state) caused a regression with mfsymlinks. If a mfsymlink dentry
> was instantiated at readdir time, then it would not be properly tossed
> out of the cache and reinstantiated when a stat or readlink call came
> about.
> 
> This patch addresses this by simply skipping instantiating dentries
> when we *know* that they will need to be immediately revalidated. The
> next attempt to use that dentry will cause a new lookup to occur
> (which is basically what we want to happen anyway).
> 
> Reported-by: David McBride <dwm37@xxxxxxxxx>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
>  fs/cifs/readdir.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index ab87784..69d2c82 100644
> --- a/fs/cifs/readdir.c
> +++ b/fs/cifs/readdir.c
> @@ -111,6 +111,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
>  			return;
>  	}
>  
> +	/*
> +	 * If we know that the inode will need to be revalidated immediately,
> +	 * then don't create a new dentry for it. We'll end up doing an on
> +	 * the wire call either way and this spares us an invalidation.
> +	 */
> +	if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
> +		return;
> +
>  	dentry = d_alloc(parent, name);
>  	if (!dentry)
>  		return;


This patch is untested (other than for compilation), but I think it'll
do the right thing. Metze, David could you test it and let us know if
it helps?

Thanks,
-- 
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux