Skip to content

Commit 3b8bb31

Browse files
Paulo AlcantaraSteve French
authored andcommitted
smb: client: do not start laundromat thread on nohandlecache
Honor 'nohandlecache' mount option by not starting laundromat thread even when SMB server supports directory leases. Do not waste system resources by having laundromat thread running with no directory caching at all. Fixes: 2da338f ("smb3: do not start laundromat thread when dir leases disabled") Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent cedc019 commit 3b8bb31

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/smb/client/connect.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,8 +2474,9 @@ cifs_put_tcon(struct cifs_tcon *tcon)
24742474
static struct cifs_tcon *
24752475
cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
24762476
{
2477-
int rc, xid;
24782477
struct cifs_tcon *tcon;
2478+
bool nohandlecache;
2479+
int rc, xid;
24792480

24802481
tcon = cifs_find_tcon(ses, ctx);
24812482
if (tcon) {
@@ -2493,14 +2494,17 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
24932494
goto out_fail;
24942495
}
24952496

2496-
if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2497-
tcon = tcon_info_alloc(true);
2497+
if (ses->server->dialect >= SMB20_PROT_ID &&
2498+
(ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING))
2499+
nohandlecache = ctx->nohandlecache;
24982500
else
2499-
tcon = tcon_info_alloc(false);
2501+
nohandlecache = true;
2502+
tcon = tcon_info_alloc(!nohandlecache);
25002503
if (tcon == NULL) {
25012504
rc = -ENOMEM;
25022505
goto out_fail;
25032506
}
2507+
tcon->nohandlecache = nohandlecache;
25042508

25052509
if (ctx->snapshot_time) {
25062510
if (ses->server->vals->protocol_id == 0) {
@@ -2662,10 +2666,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
26622666
tcon->nocase = ctx->nocase;
26632667
tcon->broken_sparse_sup = ctx->no_sparse;
26642668
tcon->max_cached_dirs = ctx->max_cached_dirs;
2665-
if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2666-
tcon->nohandlecache = ctx->nohandlecache;
2667-
else
2668-
tcon->nohandlecache = true;
26692669
tcon->nodelete = ctx->nodelete;
26702670
tcon->local_lease = ctx->local_lease;
26712671
INIT_LIST_HEAD(&tcon->pending_opens);

0 commit comments

Comments
 (0)