Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] cifs: if deferred close is disabled then close files immediately
@ 2023-07-07 15:29 Bharath SM
  2023-07-10  6:20 ` Shyam Prasad N
  0 siblings, 1 reply; 2+ messages in thread
From: Bharath SM @ 2023-07-07 15:29 UTC (permalink / raw)
  To: sfrench, pc, lsahlber, sprasad, tom, linux-cifs, bharathsm,
	nspmangalore

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: if deferred close is disabled then close files immediately
  2023-07-07 15:29 [PATCH] cifs: if deferred close is disabled then close files immediately Bharath SM
@ 2023-07-10  6:20 ` Shyam Prasad N
  0 siblings, 0 replies; 2+ messages in thread
From: Shyam Prasad N @ 2023-07-10  6:20 UTC (permalink / raw)
  To: Bharath SM; +Cc: sfrench, pc, lsahlber, sprasad, tom, linux-cifs, bharathsm

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.

-- 
Regards,
Shyam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-10  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 15:29 [PATCH] cifs: if deferred close is disabled then close files immediately Bharath SM
2023-07-10  6:20 ` Shyam Prasad N

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox