]> err.no Git - linux-2.6/commitdiff
[CIFS] lock inode open file list in close in case racing with open
authorSteve French <sfrench@us.ibm.com>
Tue, 11 Sep 2007 05:50:53 +0000 (05:50 +0000)
committerSteve French <sfrench@us.ibm.com>
Tue, 11 Sep 2007 05:50:53 +0000 (05:50 +0000)
Harmless since it only protected turning off caching for the
inode, but cleaner to lock around this in case we have a close
racing with open.

Signed-off-by: Shaggy <shaggy@us.ibm.com>
CC: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/file.c

index b1807fd1ac4030ed7d6e7bf802d9ae2677e1f392..79254919386539d5a4883f44b96a1581dcebbec0 100644 (file)
@@ -545,6 +545,7 @@ int cifs_close(struct inode *inode, struct file *file)
        } else
                rc = -EBADF;
 
+       read_lock(&GlobalSMBSeslock);
        if (list_empty(&(CIFS_I(inode)->openFileList))) {
                cFYI(1, ("closing last open instance for inode %p", inode));
                /* if the file is not open we do not know if we can cache info
@@ -552,6 +553,7 @@ int cifs_close(struct inode *inode, struct file *file)
                CIFS_I(inode)->clientCanCacheRead = FALSE;
                CIFS_I(inode)->clientCanCacheAll  = FALSE;
        }
+       read_unlock(&GlobalSMBSeslock);
        if ((rc == 0) && CIFS_I(inode)->write_behind_rc)
                rc = CIFS_I(inode)->write_behind_rc;
        FreeXid(xid);