summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorBharath SM <bharathsm@microsoft.com>2023-07-07 15:29:01 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-23 13:49:45 +0200
commit6a05de6da58a67abec06167b32c291d7a9b6770b (patch)
tree1b168ce69b0ab12eb499e0c38f7184ba4a3226a3 /fs
parentbd8cd38d3ac6b6410ac4e7401ef3dca057a9b285 (diff)
downloadlinux-6a05de6da58a67abec06167b32c291d7a9b6770b.tar.gz
cifs: if deferred close is disabled then close files immediately
commit df9d70c18616760c6504b97fec66b6379c172dbb upstream.

If defer close timeout value is set to 0, then there is no
need to include files in the deferred close list and utilize
the delayed worker for closing. Instead, we can close them
immediately.

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/client/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 9a367d4c74e4..27c6d14e369f 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -954,8 +954,8 @@ int cifs_close(struct inode *inode, struct file *file)
 		cfile = file->private_data;
 		file->private_data = NULL;
 		dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL);
-		if ((cinode->oplock == CIFS_CACHE_RHW_FLG) &&
-		    cinode->lease_granted &&
+		if ((cifs_sb->ctx->closetimeo && cinode->oplock == CIFS_CACHE_RHW_FLG)
+		    && cinode->lease_granted &&
 		    !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) &&
 		    dclose) {
 			if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {