diff mbox

[3/3] CIFS: Invaldate remote inode on the last close

Message ID AANLkTimj4RB2ZJrRtHnndSrPR7a4VodLHrH8Nv_GufmN@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pavel Shilovsky Sept. 29, 2010, 5:38 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index de046e1..68e1789 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -153,9 +153,16 @@  psx_client_can_cache:
               pCifsInode->clientCanCacheAll = true;
               pCifsInode->clientCanCacheRead = true;
               cFYI(1, "Exclusive Oplock granted on inode %p",
-                        file->f_path.dentry->d_inode);
-       } else if ((oplock & 0xF) == OPLOCK_READ)
+                    file->f_path.dentry->d_inode);
+       } else if ((oplock & 0xF) == OPLOCK_READ) {
+               pCifsInode->clientCanCacheAll = false;
               pCifsInode->clientCanCacheRead = true;
+               cFYI(1, "Level II Oplock granted on inode %p",
+                    file->f_path.dentry->d_inode);
+       } else {
+               pCifsInode->clientCanCacheAll = false;
+               pCifsInode->clientCanCacheRead = false;
+       }

       /* will have to change the unlock if we reenable the
          filemap_fdatawrite (which does not seem necessary */
@@ -211,8 +218,14 @@  client_can_cache:
               pCifsInode->clientCanCacheAll = true;
               pCifsInode->clientCanCacheRead = true;
               cFYI(1, "Exclusive Oplock granted on inode %p", inode);
-       } else if ((oplock & 0xF) == OPLOCK_READ)
+       } else if ((oplock & 0xF) == OPLOCK_READ) {
+               pCifsInode->clientCanCacheAll = false;
               pCifsInode->clientCanCacheRead = true;
+               cFYI(1, "Level II Oplock granted on inode %p", inode);
+       } else {
+               pCifsInode->clientCanCacheAll = false;
+               pCifsInode->clientCanCacheRead = false;
+       }

       return rc;
 }
@@ -633,6 +646,8 @@  int cifs_close(struct inode *inode, struct file *file)
                  on this inode, much less write behind and read ahead */
               CIFS_I(inode)->clientCanCacheRead = false;
               CIFS_I(inode)->clientCanCacheAll  = false;
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)
+                       invalidate_remote_inode(inode);
       }
       read_unlock(&GlobalSMBSeslock);
       if ((rc == 0) && CIFS_I(inode)->write_behind_rc)