Merge branch 'for-2.6.37' into for-2.6.38
[firefly-linux-kernel-4.4.55.git] / fs / cifs / fscache.c
index 9f3f5c4be16191fc59542888cdc4871bff991177..297a43d0ff7f5a4716d13eccd595286b44b3af65 100644 (file)
@@ -2,7 +2,7 @@
  *   fs/cifs/fscache.c - CIFS filesystem cache interface
  *
  *   Copyright (c) 2010 Novell, Inc.
- *   Author(s): Suresh Jayaraman (sjayaraman@suse.de>
+ *   Author(s): Suresh Jayaraman <sjayaraman@suse.de>
  *
  *   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
@@ -62,15 +62,17 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode)
 {
        struct cifsInodeInfo *cifsi = CIFS_I(inode);
        struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+       struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
 
        if (cifsi->fscache)
                return;
 
-       cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache,
-                               &cifs_fscache_inode_object_def,
-                               cifsi);
-       cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)",
-                       cifs_sb->tcon->fscache, cifsi->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,
+                               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)
@@ -117,7 +117,8 @@ void cifs_fscache_reset_inode_cookie(struct inode *inode)
                /* retire the current fscache cache and get a new one */
                fscache_relinquish_cookie(cifsi->fscache, 1);
 
-               cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache,
+               cifsi->fscache = fscache_acquire_cookie(
+                                       cifs_sb_master_tcon(cifs_sb)->fscache,
                                        &cifs_fscache_inode_object_def,
                                        cifsi);
                cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p",