patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Namjae Jeon <linkinjeon@kernel.org>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6 075/102] ksmbd: add continuous availability share parameter
Date: Thu, 23 May 2024 15:13:40 +0200	[thread overview]
Message-ID: <20240523130345.295295379@linuxfoundation.org> (raw)
In-Reply-To: <20240523130342.462912131@linuxfoundation.org>

6.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Namjae Jeon <linkinjeon@kernel.org>

[ Upstream commit e9d8c2f95ab8acaf3f4d4a53682a4afa3c263692 ]

If capabilities of the share is not SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY,
ksmbd should not grant a persistent handle to the client.
This patch add continuous availability share parameter to control it.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/server/ksmbd_netlink.h | 35 ++++++++++++++++++-----------------
 fs/smb/server/smb2pdu.c       | 11 +++++++++--
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/fs/smb/server/ksmbd_netlink.h b/fs/smb/server/ksmbd_netlink.h
index 686b321c5a8bb..f4e55199938d5 100644
--- a/fs/smb/server/ksmbd_netlink.h
+++ b/fs/smb/server/ksmbd_netlink.h
@@ -340,23 +340,24 @@ enum KSMBD_TREE_CONN_STATUS {
 /*
  * Share config flags.
  */
-#define KSMBD_SHARE_FLAG_INVALID		(0)
-#define KSMBD_SHARE_FLAG_AVAILABLE		BIT(0)
-#define KSMBD_SHARE_FLAG_BROWSEABLE		BIT(1)
-#define KSMBD_SHARE_FLAG_WRITEABLE		BIT(2)
-#define KSMBD_SHARE_FLAG_READONLY		BIT(3)
-#define KSMBD_SHARE_FLAG_GUEST_OK		BIT(4)
-#define KSMBD_SHARE_FLAG_GUEST_ONLY		BIT(5)
-#define KSMBD_SHARE_FLAG_STORE_DOS_ATTRS	BIT(6)
-#define KSMBD_SHARE_FLAG_OPLOCKS		BIT(7)
-#define KSMBD_SHARE_FLAG_PIPE			BIT(8)
-#define KSMBD_SHARE_FLAG_HIDE_DOT_FILES		BIT(9)
-#define KSMBD_SHARE_FLAG_INHERIT_OWNER		BIT(10)
-#define KSMBD_SHARE_FLAG_STREAMS		BIT(11)
-#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS	BIT(12)
-#define KSMBD_SHARE_FLAG_ACL_XATTR		BIT(13)
-#define KSMBD_SHARE_FLAG_UPDATE			BIT(14)
-#define KSMBD_SHARE_FLAG_CROSSMNT		BIT(15)
+#define KSMBD_SHARE_FLAG_INVALID			(0)
+#define KSMBD_SHARE_FLAG_AVAILABLE			BIT(0)
+#define KSMBD_SHARE_FLAG_BROWSEABLE			BIT(1)
+#define KSMBD_SHARE_FLAG_WRITEABLE			BIT(2)
+#define KSMBD_SHARE_FLAG_READONLY			BIT(3)
+#define KSMBD_SHARE_FLAG_GUEST_OK			BIT(4)
+#define KSMBD_SHARE_FLAG_GUEST_ONLY			BIT(5)
+#define KSMBD_SHARE_FLAG_STORE_DOS_ATTRS		BIT(6)
+#define KSMBD_SHARE_FLAG_OPLOCKS			BIT(7)
+#define KSMBD_SHARE_FLAG_PIPE				BIT(8)
+#define KSMBD_SHARE_FLAG_HIDE_DOT_FILES			BIT(9)
+#define KSMBD_SHARE_FLAG_INHERIT_OWNER			BIT(10)
+#define KSMBD_SHARE_FLAG_STREAMS			BIT(11)
+#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS		BIT(12)
+#define KSMBD_SHARE_FLAG_ACL_XATTR			BIT(13)
+#define KSMBD_SHARE_FLAG_UPDATE				BIT(14)
+#define KSMBD_SHARE_FLAG_CROSSMNT			BIT(15)
+#define KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY	BIT(16)
 
 /*
  * Tree connect request flags.
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 75db0e63bcebd..1e536ae277618 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -1988,7 +1988,12 @@ int smb2_tree_connect(struct ksmbd_work *work)
 	write_unlock(&sess->tree_conns_lock);
 	rsp->StructureSize = cpu_to_le16(16);
 out_err1:
-	rsp->Capabilities = 0;
+	if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE &&
+	    test_share_config_flag(share,
+				   KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY))
+		rsp->Capabilities = SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY;
+	else
+		rsp->Capabilities = 0;
 	rsp->Reserved = 0;
 	/* default manual caching */
 	rsp->ShareFlags = SMB2_SHAREFLAG_MANUAL_CACHING;
@@ -3502,7 +3507,9 @@ int smb2_open(struct ksmbd_work *work)
 	memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
 
 	if (dh_info.type == DURABLE_REQ_V2 || dh_info.type == DURABLE_REQ) {
-		if (dh_info.type == DURABLE_REQ_V2 && dh_info.persistent)
+		if (dh_info.type == DURABLE_REQ_V2 && dh_info.persistent &&
+		    test_share_config_flag(work->tcon->share_conf,
+					   KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY))
 			fp->is_persistent = true;
 		else
 			fp->is_durable = true;
-- 
2.43.0




  parent reply	other threads:[~2024-05-23 13:25 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 13:12 [PATCH 6.6 000/102] 6.6.32-rc1 review Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 001/102] cifs: Add client version details to NTLM authenticate message Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 002/102] SMB3: clarify some of the unused CreateOption flags Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 003/102] Add definition for new smb3.1.1 command type Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 004/102] smb: use crypto_shash_digest() in symlink_hash() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 005/102] cifs: print server capabilities in DebugData Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 006/102] smb3: minor RDMA cleanup Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 007/102] smb3: more minor cleanups for session handling routines Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 008/102] smb3: minor cleanup of session handling code Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 009/102] Missing field not being returned in ioctl CIFS_IOC_GET_MNT_INFO Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 010/102] cifs: fix use after free for iface while disabling secondary channels Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 011/102] smb: client: introduce cifs_sfu_make_node() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 012/102] smb: client: Fix minor whitespace errors and warnings Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 013/102] smb: client: extend smb2_compound_op() to accept more commands Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 014/102] smb: client: allow creating special files via reparse points Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 015/102] smb: client: optimise reparse point querying Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 016/102] smb: client: allow creating symlinks via reparse points Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 017/102] smb: client: cleanup smb2_query_reparse_point() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 018/102] smb: client: handle special files and symlinks in SMB3 POSIX Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 019/102] cifs: fix in logging in cifs_chan_update_iface Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 020/102] smb3: Improve exception handling in allocate_mr_list() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 021/102] cifs: Pass unbyteswapped eof value into SMB2_set_eof() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 022/102] cifs: get rid of dup length check in parse_reparse_point() Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 023/102] cifs: remove unneeded return statement Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 024/102] ksmbd: auth: fix most kernel-doc warnings Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 025/102] ksmbd: vfs: fix all " Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 026/102] cifs: remove redundant variable tcon_exist Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 027/102] cifs: minor comment cleanup Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 028/102] cifs: pick channel for tcon and tdis Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 029/102] cifs: new nt status codes from MS-SMB2 Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 030/102] smb: client: dont clobber ->i_rdev from cached reparse points Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 031/102] cifs: new mount option called retrans Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 032/102] smb: Fix some kernel-doc comments Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 033/102] smb: client: delete "true", "false" defines Greg Kroah-Hartman
2024-05-23 13:12 ` [PATCH 6.6 034/102] cifs: commands that are retried should have replay flag set Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 035/102] cifs: set replay flag for retries of write command Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 036/102] ksmbd: Add kernel-doc for ksmbd_extract_sharename() function Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 037/102] cifs: update the same create_guid on replay Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 038/102] smb: client: handle path separator of created SMB symlinks Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 039/102] smb3: update allocation size more accurately on write completion Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 040/102] smb: client: parse owner/group when creating reparse points Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 041/102] smb: client: get rid of smb311_posix_query_path_info() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 042/102] smb: client: reuse file lease key in compound operations Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 043/102] smb: client: do not defer close open handles to deleted files Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 044/102] smb: client: retry compound request without reusing lease Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 045/102] smb: client: introduce reparse mount option Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 046/102] smb: client: move most of reparse point handling code to common file Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 047/102] smb: client: fix potential broken compound request Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 048/102] smb: client: reduce number of parameters in smb2_compound_op() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 049/102] smb: client: add support for WSL reparse points Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 050/102] smb: client: Fix a NULL vs IS_ERR() check in wsl_set_xattrs() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 051/102] smb: client: introduce SMB2_OP_QUERY_WSL_EA Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 052/102] smb: client: parse uid, gid, mode and dev from WSL reparse points Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 053/102] smb: client: set correct d_type for reparse DFS/DFSR and mount point Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 054/102] smb: client: return reparse type in /proc/mounts Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 055/102] smb3: add dynamic trace point for ioctls Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 056/102] smb: client: negotiate compression algorithms Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 057/102] smb: common: fix fields sizes in compression_pattern_payload_v1 Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 058/102] smb: common: simplify compression headers Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 059/102] ksmbd: mark SMB2_SESSION_EXPIRED to session when destroying previous session Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 060/102] ksmbd: add support for durable handles v1/v2 Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 061/102] cifs: defer close file handles having RH lease Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 062/102] cifs: fixes for get_inode_info Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 063/102] cifs: remove redundant variable assignment Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 064/102] ksmbd: fix possible null-deref in smb_lazy_parent_lease_break_close Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 065/102] ksmbd: Fix spelling mistake "connction" -> "connection" Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 066/102] ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 067/102] ksmbd: fix potencial out-of-bounds when buffer offset is invalid Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 068/102] cifs: Move some extern decls from .c files to .h Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 069/102] smb311: correct incorrect offset field in compression header Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 070/102] smb311: additional compression flag defined in updated protocol spec Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 071/102] smb3: add trace event for mknod Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 072/102] smb: client: fix NULL ptr deref in cifs_mark_open_handles_for_deleted_file() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 073/102] smb: client: instantiate when creating SFU files Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 074/102] cifs: Add tracing for the cifs_tcon struct refcounting Greg Kroah-Hartman
2024-05-23 13:13 ` Greg Kroah-Hartman [this message]
2024-05-23 13:13 ` [PATCH 6.6 076/102] smb: smb2pdu.h: Avoid -Wflex-array-member-not-at-end warnings Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 077/102] drm/amd/display: Fix division by zero in setup_dsc_config Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 078/102] net: ks8851: Fix another TX stall caused by wrong ISR flag handling Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 079/102] ice: pass VSI pointer into ice_vc_isvalid_q_id Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 080/102] ice: remove unnecessary duplicate checks for VF VSI ID Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 081/102] Bluetooth: L2CAP: Fix slab-use-after-free in l2cap_connect() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 082/102] Bluetooth: L2CAP: Fix div-by-zero in l2cap_le_flowctl_init() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 083/102] KEYS: trusted: Fix memory leak in tpm2_key_encode() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 084/102] mmc: core: Add HS400 tuning in HS400es initialization Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 085/102] kselftest: Add a ksft_perror() helper Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 086/102] bpf: Add missing BPF_LINK_TYPE invocations Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 087/102] erofs: get rid of erofs_fs_context Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 088/102] erofs: reliably distinguish block based and fscache mode Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 089/102] drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper() Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 090/102] binder: fix max_thread type inconsistency Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 091/102] usb: dwc3: Wait unconditionally after issuing EndXfer command Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 092/102] net: usb: ax88179_178a: fix link status when link is set to down/up Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 093/102] usb: typec: ucsi: displayport: Fix potential deadlock Greg Kroah-Hartman
2024-05-23 13:13 ` [PATCH 6.6 094/102] usb: typec: tipd: fix event checking for tps6598x Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 095/102] serial: kgdboc: Fix NMI-safety problems from keyboard reset code Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 096/102] remoteproc: mediatek: Make sure IPI buffer fits in L2TCM Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 097/102] KEYS: trusted: Do not use WARN when encode fails Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 098/102] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 099/102] docs: kernel_include.py: Cope with docutils 0.21 Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 100/102] Docs/admin-guide/mm/damon/usage: fix wrong example of DAMOS filter matching sysfs file Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 101/102] block: add a disk_has_partscan helper Greg Kroah-Hartman
2024-05-23 13:14 ` [PATCH 6.6 102/102] block: add a partscan sysfs attribute for disks Greg Kroah-Hartman
2024-05-23 17:04 ` [PATCH 6.6 000/102] 6.6.32-rc1 review SeongJae Park
2024-05-23 17:40 ` Mark Brown
2024-05-23 20:39 ` Florian Fainelli
2024-05-23 21:25 ` Takeshi Ogasawara
2024-05-24  6:53 ` Harshit Mogalapalli
2024-05-24 10:00 ` Anders Roxell
2024-05-24 14:35 ` Shuah Khan
2024-05-24 15:19 ` Jon Hunter
2024-05-24 20:36 ` Ron Economos
2024-05-25  1:07 ` Kelsey Steele
2024-05-25 16:25 ` Allen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240523130345.295295379@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linkinjeon@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).