summaryrefslogtreecommitdiff
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSamuel Cabrero <scabrero@suse.de>2020-12-11 22:59:29 -0600
committerSteve French <stfrench@microsoft.com>2020-12-14 09:16:22 -0600
commit0ac4e2919aa408dfd0fb9ce08ac331a9deeea807 (patch)
treee09dd54e5e8d66d27741e2297b858e0e7d88beb6 /fs/cifs/connect.c
parent06f08dab3ca726b86431889495c45049616d6a15 (diff)
cifs: add witness mount option and data structs
Add 'witness' mount option to register for witness notifications. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ec80b6c3e20f..ead1c086b88d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1944,6 +1944,8 @@ cifs_put_tcon(struct cifs_tcon *tcon)
return;
}
+ /* TODO witness unregister */
+
list_del_init(&tcon->tcon_list);
spin_unlock(&cifs_tcp_ses_lock);
@@ -2104,6 +2106,26 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
}
tcon->use_resilient = true;
}
+#ifdef CONFIG_CIFS_SWN_UPCALL
+ tcon->use_witness = false;
+ if (ctx->witness) {
+ if (ses->server->vals->protocol_id >= SMB30_PROT_ID) {
+ if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) {
+ /* TODO witness register */
+ tcon->use_witness = true;
+ } else {
+ /* TODO: try to extend for non-cluster uses (eg multichannel) */
+ cifs_dbg(VFS, "witness requested on mount but no CLUSTER capability on share\n");
+ rc = -EOPNOTSUPP;
+ goto out_fail;
+ }
+ } else {
+ cifs_dbg(VFS, "SMB3 or later required for witness option\n");
+ rc = -EOPNOTSUPP;
+ goto out_fail;
+ }
+ }
+#endif
/* If the user really knows what they are doing they can override */
if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
@@ -3856,6 +3878,9 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
ctx->sectype = master_tcon->ses->sectype;
ctx->sign = master_tcon->ses->sign;
ctx->seal = master_tcon->seal;
+#ifdef CONFIG_CIFS_SWN_UPCALL
+ ctx->witness = master_tcon->use_witness;
+#endif
rc = cifs_set_vol_auth(ctx, master_tcon->ses);
if (rc) {