diff mbox series

cifs: if deferred close is disabled then close files immediately

Message ID 20230707152901.503213-1-bharathsm@microsoft.com (mailing list archive)
State New, archived
Headers show
Series cifs: if deferred close is disabled then close files immediately | expand

Commit Message

Bharath SM July 7, 2023, 3:29 p.m. UTC
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>
---
 fs/smb/client/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Shyam Prasad N July 10, 2023, 6:20 a.m. UTC | #1
On Fri, Jul 7, 2023 at 9:00 PM Bharath SM <bharathsm.hsk@gmail.com> wrote:
>
> 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>
> ---
>  fs/smb/client/file.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
> index df88b8c04d03..5a58d438e044 100644
> --- a/fs/smb/client/file.c
> +++ b/fs/smb/client/file.c
> @@ -1080,8 +1080,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)) {
> --
> 2.34.1
>

Looks good to me. And should be CC stable.
diff mbox series

Patch

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index df88b8c04d03..5a58d438e044 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -1080,8 +1080,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)) {