diff mbox series

[v2,1/3] smb: client: disable directory caching when dir_cache_timeout is zero

Message ID 20241123011437.375637-1-henrique.carvalho@suse.com
State New
Headers show
Series [v2,1/3] smb: client: disable directory caching when dir_cache_timeout is zero | expand

Commit Message

Henrique Carvalho Nov. 23, 2024, 1:14 a.m. UTC
Setting dir_cache_timeout to zero should disable the caching of
directory contents. Currently, even when dir_cache_timeout is zero,
some caching related functions are still invoked, which is unintended
behavior.

Fix the issue by setting tcon->nohandlecache to true when
dir_cache_timeout is zero, ensuring that directory handle caching
is properly disabled.

Fixes: 238b351d0935 ("smb3: allow controlling length of time directory entries are cached with dir leases")
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
---
V1 -> V2: Split patch and addressed review comments

 fs/smb/client/connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paulo Alcantara Nov. 24, 2024, 10:14 p.m. UTC | #1
Henrique Carvalho <henrique.carvalho@suse.com> writes:

> Setting dir_cache_timeout to zero should disable the caching of
> directory contents. Currently, even when dir_cache_timeout is zero,
> some caching related functions are still invoked, which is unintended
> behavior.
>
> Fix the issue by setting tcon->nohandlecache to true when
> dir_cache_timeout is zero, ensuring that directory handle caching
> is properly disabled.
>
> Fixes: 238b351d0935 ("smb3: allow controlling length of time directory entries are cached with dir leases")
> Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
> ---
> V1 -> V2: Split patch and addressed review comments
>
>  fs/smb/client/connect.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Steve French Nov. 25, 2024, 1:19 a.m. UTC | #2
added the reviewed-by for these three. Testing seems to be going ok on
these so far - let me know if any updates or missed/new patches

On Sun, Nov 24, 2024 at 4:14 PM Paulo Alcantara <pc@manguebit.com> wrote:
>
> Henrique Carvalho <henrique.carvalho@suse.com> writes:
>
> > Setting dir_cache_timeout to zero should disable the caching of
> > directory contents. Currently, even when dir_cache_timeout is zero,
> > some caching related functions are still invoked, which is unintended
> > behavior.
> >
> > Fix the issue by setting tcon->nohandlecache to true when
> > dir_cache_timeout is zero, ensuring that directory handle caching
> > is properly disabled.
> >
> > Fixes: 238b351d0935 ("smb3: allow controlling length of time directory entries are cached with dir leases")
> > Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
> > ---
> > V1 -> V2: Split patch and addressed review comments
> >
> >  fs/smb/client/connect.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
>
Enzo Matsumiya Nov. 25, 2024, 4:17 p.m. UTC | #3
On 11/22, Henrique Carvalho wrote:
>Setting dir_cache_timeout to zero should disable the caching of
>directory contents. Currently, even when dir_cache_timeout is zero,
>some caching related functions are still invoked, which is unintended
>behavior.
>
>Fix the issue by setting tcon->nohandlecache to true when
>dir_cache_timeout is zero, ensuring that directory handle caching
>is properly disabled.
>
>Fixes: 238b351d0935 ("smb3: allow controlling length of time directory entries are cached with dir leases")
>Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
>---
>V1 -> V2: Split patch and addressed review comments
>
> fs/smb/client/connect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
>index b227d61a6f205..62a29183c655c 100644
>--- a/fs/smb/client/connect.c
>+++ b/fs/smb/client/connect.c
>@@ -2614,7 +2614,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
>
> 	if (ses->server->dialect >= SMB20_PROT_ID &&
> 	    (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING))
>-		nohandlecache = ctx->nohandlecache;
>+		nohandlecache = ctx->nohandlecache || !dir_cache_timeout;
> 	else
> 		nohandlecache = true;
> 	tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new);

Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>


Cheers
diff mbox series

Patch

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index b227d61a6f205..62a29183c655c 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2614,7 +2614,7 @@  cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 
 	if (ses->server->dialect >= SMB20_PROT_ID &&
 	    (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING))
-		nohandlecache = ctx->nohandlecache;
+		nohandlecache = ctx->nohandlecache || !dir_cache_timeout;
 	else
 		nohandlecache = true;
 	tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new);