diff options
author | Steve French <sfrench@us.ibm.com> | 2007-09-11 01:50:53 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-09-11 01:50:53 -0400 |
commit | 4efa53f0907bb4378015c129a2c11b8d3a90bce2 (patch) | |
tree | 030c88b99de6caaf58cee600c5d697460c215b6c /fs/cifs/file.c | |
parent | 15745320f374aa6cbfe4836b76469159c0f49640 (diff) |
[CIFS] lock inode open file list in close in case racing with open
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>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index b1807fd1ac40..792549193865 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -545,6 +545,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
545 | } else | 545 | } else |
546 | rc = -EBADF; | 546 | rc = -EBADF; |
547 | 547 | ||
548 | read_lock(&GlobalSMBSeslock); | ||
548 | if (list_empty(&(CIFS_I(inode)->openFileList))) { | 549 | if (list_empty(&(CIFS_I(inode)->openFileList))) { |
549 | cFYI(1, ("closing last open instance for inode %p", inode)); | 550 | cFYI(1, ("closing last open instance for inode %p", inode)); |
550 | /* if the file is not open we do not know if we can cache info | 551 | /* 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) | |||
552 | CIFS_I(inode)->clientCanCacheRead = FALSE; | 553 | CIFS_I(inode)->clientCanCacheRead = FALSE; |
553 | CIFS_I(inode)->clientCanCacheAll = FALSE; | 554 | CIFS_I(inode)->clientCanCacheAll = FALSE; |
554 | } | 555 | } |
556 | read_unlock(&GlobalSMBSeslock); | ||
555 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) | 557 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) |
556 | rc = CIFS_I(inode)->write_behind_rc; | 558 | rc = CIFS_I(inode)->write_behind_rc; |
557 | FreeXid(xid); | 559 | FreeXid(xid); |