Skip to content

Commit

Permalink
cifs: handle "nolease" option for vers=1.0
Browse files Browse the repository at this point in the history
The "nolease" mount option is only supported for SMB2+ mounts.
Fail with appropriate error message if vers=1.0 option is passed.

Signed-off-by: Kenneth D'souza <[email protected]>
Reviewed-by: Pavel Shilovsky <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
Kenneth D'souza authored and Steve French committed Jun 1, 2020
1 parent 3d77e6a commit 8fd6e1d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3580,6 +3580,16 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
cifs_dbg(VFS, "cache=singleclient requested on mount but NO_CACHING flag set on share\n");
}

if (volume_info->no_lease) {
if (ses->server->vals->protocol_id == 0) {
cifs_dbg(VFS,
"SMB2 or later required for nolease option\n");
rc = -EOPNOTSUPP;
goto out_fail;
} else
tcon->no_lease = volume_info->no_lease;
}

/*
* We can have only one retry value for a connection to a share so for
* resources mounted more than once to the same server share the last
Expand All @@ -3589,7 +3599,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
tcon->nocase = volume_info->nocase;
tcon->nohandlecache = volume_info->nohandlecache;
tcon->local_lease = volume_info->local_lease;
tcon->no_lease = volume_info->no_lease;
INIT_LIST_HEAD(&tcon->pending_opens);

spin_lock(&cifs_tcp_ses_lock);
Expand Down

0 comments on commit 8fd6e1d

Please sign in to comment.