On Wed, 24 Nov 2010 17:49:06 +0530
Suresh Jayaraman <[email protected]> wrote:

> Currently, if CONFIG_CIFS_FSCACHE is set, fscache is enabled on files opened
> as read-only irrespective of the 'fsc' mount option. Fix this by enabling
> fscache only if 'fsc' mount option is specified explicitly.
> 
> Remove an extraneous cFYI debug message and fix a typo while at it.
> 
> Reported-by: Jeff Layton <[email protected]>
> Signed-off-by: Suresh Jayaraman <[email protected]>
> ---
>  fs/cifs/fscache.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
> index a2ad94e..297a43d 100644
> --- a/fs/cifs/fscache.c
> +++ b/fs/cifs/fscache.c
> @@ -2,7 +2,7 @@
>   *   fs/cifs/fscache.c - CIFS filesystem cache interface
>   *
>   *   Copyright (c) 2010 Novell, Inc.
> - *   Author(s): Suresh Jayaraman ([email protected]>
> + *   Author(s): Suresh Jayaraman <[email protected]>
>   *
>   *   This library is free software; you can redistribute it and/or modify
>   *   it under the terms of the GNU Lesser General Public License as published
> @@ -67,10 +67,12 @@ static void cifs_fscache_enable_inode_cookie(struct inode 
> *inode)
>       if (cifsi->fscache)
>               return;
>  
> -     cifsi->fscache = fscache_acquire_cookie(tcon->fscache,
> +     if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE) {
> +             cifsi->fscache = fscache_acquire_cookie(tcon->fscache,
>                               &cifs_fscache_inode_object_def, cifsi);
> -     cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)", tcon->fscache,
> +             cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)", tcon->fscache,
>                               cifsi->fscache);
> +     }
>  }
>  
>  void cifs_fscache_release_inode_cookie(struct inode *inode)
> @@ -101,10 +103,8 @@ void cifs_fscache_set_inode_cookie(struct inode *inode, 
> struct file *filp)
>  {
>       if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
>               cifs_fscache_disable_inode_cookie(inode);
> -     else {
> +     else
>               cifs_fscache_enable_inode_cookie(inode);
> -             cFYI(1, "CIFS: fscache inode cookie set");
> -     }
>  }
>  
>  void cifs_fscache_reset_inode_cookie(struct inode *inode)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Ok, so we're disabling fscache by just not setting the cookie on the
inode, but the server->fscache and tcon->fscache pointers get set
unconditionally. I suppose that makes sense since we could have someone
mount a tcon without fsc set and then later mount the same one with it
set.

Looks reasonable, I guess...

Acked-by: Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to