From: Stefan Metzmacher Date: Tue, 31 Jul 2012 06:55:20 +0000 (+0200) Subject: smb2_tcon: add "smb3 share cap:{CONTINUOUS AVAILABILITY,SCALE OUT,CLUSTER,ASYMMETRIC... X-Git-Tag: talloc-2.4.2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=447e131ebf2b7bb02e7dfbb0ee38c2d656632856;p=thirdparty%2Fsamba.git smb2_tcon: add "smb3 share cap:{CONTINUOUS AVAILABILITY,SCALE OUT,CLUSTER,ASYMMETRIC}" options Signed-off-by: Stefan Metzmacher Reviewed-by: Günther Deschner Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Fri Jan 26 18:04:10 UTC 2024 on atb-devel-224 --- diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 5bd01c77e05..fca35e36ce5 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -421,6 +421,78 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req, *out_share_flags |= SMB2_SHAREFLAG_ENCRYPT_DATA; } + /* + * For disk shares we can change the client + * behavior on a cluster... + */ + if (*out_share_type == SMB2_SHARE_TYPE_DISK) { + bool persistent = false; /* persistent handles not implemented yet */ + bool cluster = lp_clustering(); + bool asymmetric = false; /* shares are symmetric by default */ + bool announce; + + /* + * In a ctdb cluster shares are continuously available, + * but windows clients mix this with the global persistent + * handles support. + * + * Persistent handles are requested if + * SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY is present + * even without SMB2_CAP_PERSISTENT_HANDLES. + * + * And SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY is + * required for SMB2_SHARE_CAP_CLUSTER to have + * an effect. + * + * So we better don't announce this by default + * until we support persistent handles. + */ + announce = lp_parm_bool(SNUM(tcon->compat), + "smb3 share cap", + "CONTINUOUS AVAILABILITY", + persistent); + if (announce) { + *out_capabilities |= SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY; + } + + /* + * ctdb clusters are always scale out... + */ + announce = lp_parm_bool(SNUM(tcon->compat), + "smb3 share cap", + "SCALE OUT", + cluster); + if (announce) { + *out_capabilities |= SMB2_SHARE_CAP_SCALEOUT; + } + + /* + * We support the witness service when ctdb is active + */ + announce = lp_parm_bool(SNUM(tcon->compat), + "smb3 share cap", + "CLUSTER", + cluster); + if (announce) { + *out_capabilities |= SMB2_SHARE_CAP_CLUSTER; + } + + /* + * Shares in a ctdb cluster are symmetric by design. + * + * But it might be useful to let the client use + * an isolated transport and witness registration for the + * specific share. + */ + announce = lp_parm_bool(SNUM(tcon->compat), + "smb3 share cap", + "ASYMMETRIC", + asymmetric); + if (announce) { + *out_capabilities |= SMB2_SHARE_CAP_ASYMMETRIC; + } + } + *out_maximal_access = tcon->compat->share_access; *out_tree_id = tcon->global->tcon_wire_id;