mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 11:30:53 +07:00
smb3: allow disabling requesting leases
In some cases to work around server bugs or performance problems it can be helpful to be able to disable requesting SMB2.1/SMB3 leases on a particular mount (not to all servers and all shares we are mounted to). Add new mount parm "nolease" which turns off requesting leases on directory or file opens. Currently the only way to disable leases is globally through a module load parameter. This is more granular. Suggested-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com> CC: Stable <stable@vger.kernel.org>
This commit is contained in:
parent
7dcc82c2df
commit
3e7a02d478
@ -438,6 +438,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
|
|||||||
cifs_show_security(s, tcon->ses);
|
cifs_show_security(s, tcon->ses);
|
||||||
cifs_show_cache_flavor(s, cifs_sb);
|
cifs_show_cache_flavor(s, cifs_sb);
|
||||||
|
|
||||||
|
if (tcon->no_lease)
|
||||||
|
seq_puts(s, ",nolease");
|
||||||
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
|
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
|
||||||
seq_puts(s, ",multiuser");
|
seq_puts(s, ",multiuser");
|
||||||
else if (tcon->ses->user_name)
|
else if (tcon->ses->user_name)
|
||||||
|
@ -579,6 +579,7 @@ struct smb_vol {
|
|||||||
bool noblocksnd:1;
|
bool noblocksnd:1;
|
||||||
bool noautotune:1;
|
bool noautotune:1;
|
||||||
bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
|
bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
|
||||||
|
bool no_lease:1; /* disable requesting leases */
|
||||||
bool fsc:1; /* enable fscache */
|
bool fsc:1; /* enable fscache */
|
||||||
bool mfsymlinks:1; /* use Minshall+French Symlinks */
|
bool mfsymlinks:1; /* use Minshall+French Symlinks */
|
||||||
bool multiuser:1;
|
bool multiuser:1;
|
||||||
@ -1090,6 +1091,7 @@ struct cifs_tcon {
|
|||||||
bool need_reopen_files:1; /* need to reopen tcon file handles */
|
bool need_reopen_files:1; /* need to reopen tcon file handles */
|
||||||
bool use_resilient:1; /* use resilient instead of durable handles */
|
bool use_resilient:1; /* use resilient instead of durable handles */
|
||||||
bool use_persistent:1; /* use persistent instead of durable handles */
|
bool use_persistent:1; /* use persistent instead of durable handles */
|
||||||
|
bool no_lease:1; /* Do not request leases on files or directories */
|
||||||
__le32 capabilities;
|
__le32 capabilities;
|
||||||
__u32 share_flags;
|
__u32 share_flags;
|
||||||
__u32 maximal_access;
|
__u32 maximal_access;
|
||||||
|
@ -74,7 +74,7 @@ enum {
|
|||||||
Opt_user_xattr, Opt_nouser_xattr,
|
Opt_user_xattr, Opt_nouser_xattr,
|
||||||
Opt_forceuid, Opt_noforceuid,
|
Opt_forceuid, Opt_noforceuid,
|
||||||
Opt_forcegid, Opt_noforcegid,
|
Opt_forcegid, Opt_noforcegid,
|
||||||
Opt_noblocksend, Opt_noautotune,
|
Opt_noblocksend, Opt_noautotune, Opt_nolease,
|
||||||
Opt_hard, Opt_soft, Opt_perm, Opt_noperm,
|
Opt_hard, Opt_soft, Opt_perm, Opt_noperm,
|
||||||
Opt_mapposix, Opt_nomapposix,
|
Opt_mapposix, Opt_nomapposix,
|
||||||
Opt_mapchars, Opt_nomapchars, Opt_sfu,
|
Opt_mapchars, Opt_nomapchars, Opt_sfu,
|
||||||
@ -135,6 +135,7 @@ static const match_table_t cifs_mount_option_tokens = {
|
|||||||
{ Opt_noforcegid, "noforcegid" },
|
{ Opt_noforcegid, "noforcegid" },
|
||||||
{ Opt_noblocksend, "noblocksend" },
|
{ Opt_noblocksend, "noblocksend" },
|
||||||
{ Opt_noautotune, "noautotune" },
|
{ Opt_noautotune, "noautotune" },
|
||||||
|
{ Opt_nolease, "nolease" },
|
||||||
{ Opt_hard, "hard" },
|
{ Opt_hard, "hard" },
|
||||||
{ Opt_soft, "soft" },
|
{ Opt_soft, "soft" },
|
||||||
{ Opt_perm, "perm" },
|
{ Opt_perm, "perm" },
|
||||||
@ -1738,6 +1739,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
|
|||||||
case Opt_noautotune:
|
case Opt_noautotune:
|
||||||
vol->noautotune = 1;
|
vol->noautotune = 1;
|
||||||
break;
|
break;
|
||||||
|
case Opt_nolease:
|
||||||
|
vol->no_lease = 1;
|
||||||
|
break;
|
||||||
case Opt_hard:
|
case Opt_hard:
|
||||||
vol->retry = 1;
|
vol->retry = 1;
|
||||||
break;
|
break;
|
||||||
@ -3294,6 +3298,8 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb_vol *volume_info)
|
|||||||
return 0;
|
return 0;
|
||||||
if (tcon->handle_timeout != volume_info->handle_timeout)
|
if (tcon->handle_timeout != volume_info->handle_timeout)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (tcon->no_lease != volume_info->no_lease)
|
||||||
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3516,6 +3522,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
|
|||||||
tcon->nocase = volume_info->nocase;
|
tcon->nocase = volume_info->nocase;
|
||||||
tcon->nohandlecache = volume_info->nohandlecache;
|
tcon->nohandlecache = volume_info->nohandlecache;
|
||||||
tcon->local_lease = volume_info->local_lease;
|
tcon->local_lease = volume_info->local_lease;
|
||||||
|
tcon->no_lease = volume_info->no_lease;
|
||||||
INIT_LIST_HEAD(&tcon->pending_opens);
|
INIT_LIST_HEAD(&tcon->pending_opens);
|
||||||
|
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
|
@ -2459,7 +2459,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock,
|
|||||||
iov[1].iov_len = uni_path_len;
|
iov[1].iov_len = uni_path_len;
|
||||||
iov[1].iov_base = path;
|
iov[1].iov_base = path;
|
||||||
|
|
||||||
if (!server->oplocks)
|
if ((!server->oplocks) || (tcon->no_lease))
|
||||||
*oplock = SMB2_OPLOCK_LEVEL_NONE;
|
*oplock = SMB2_OPLOCK_LEVEL_NONE;
|
||||||
|
|
||||||
if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) ||
|
if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user