From: "Pali Rohár" <pali@kernel.org>
To: Paulo Alcantara <pc@manguebit.org>, Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v7.3 6/9] cifs: Extend ->set_EA() callback to allow operate on reparse point
Date: Mon, 26 Oct 2026 23:25:57 +0100 [thread overview]
Message-ID: <20261026222600.17323-7-pali@kernel.org> (raw)
In-Reply-To: <20261026222600.17323-1-pali@kernel.org>
Upcoming changes for setting EAs needs to operate on the reparse point
iself. This change extend >set_EA() callback with a new boolean parameter
to allow it.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/cifssmb.c | 20 +++++++++++++++++++-
fs/smb/client/smb1proto.h | 3 ++-
fs/smb/client/smb2ops.c | 6 ++++--
fs/smb/client/xattr.c | 3 ++-
5 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 5c5b76a9e9fe..d5faef5f3a73 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -570,6 +570,7 @@ struct smb_version_operations {
const unsigned char *, const unsigned char *, char *,
size_t, struct cifs_sb_info *);
int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
+ bool open_reparse_point,
const char *, const void *, const __u16,
const struct nls_table *, struct cifs_sb_info *);
struct smb_ntsd * (*get_acl)(struct cifs_sb_info *cifssb, struct inode *ino,
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 8bdd81af6d21..07c7d6fa97c4 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -3166,6 +3166,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,
rc = CIFSSMBSetEA(xid,
tcon,
full_path,
+ true /* open reparse point */,
&ea->ea_data[0],
&ea->ea_data[ea->ea_name_length+1],
le16_to_cpu(ea->ea_value_length),
@@ -6322,7 +6323,8 @@ CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
int
CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
- const char *fileName, const char *ea_name, const void *ea_value,
+ const char *fileName, bool open_reparse_point,
+ const char *ea_name, const void *ea_value,
const __u16 ea_value_len, const struct nls_table *nls_codepage,
struct cifs_sb_info *cifs_sb)
{
@@ -6338,6 +6340,22 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
int remap = cifs_remap(cifs_sb);
unsigned int total_len;
+ /*
+ * On NT systems which supports reparse points, the TRANS2_SET_PATH_INFORMATION
+ * operates on the reparse point itself and not the path location where reparse
+ * point redirects. So the behavior of TRANS2_SET_PATH_INFORMATION is as if the
+ * path was opened with OPEN_REPARSE_POINT flag. Hence this SMB1 SetEA function
+ * implements only the behavior of "open_reparse_point=true" parameter.
+ *
+ * TODO: Implement "open_reparse_point=false" support for SMB1 SetEA. For this
+ * is needed to call NT OPEN without OPEN_REPARSE_POINT flag and then call
+ * TRANS2_SET_FILE_INFORMATION.
+ *
+ * On systems which do not support reparse points, the behavior of both
+ * "open_reparse_point=true" and "open_reparse_point=false" is same.
+ */
+ (void)open_reparse_point;
+
cifs_dbg(FYI, "In SetEA\n");
SetEARetry:
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
diff --git a/fs/smb/client/smb1proto.h b/fs/smb/client/smb1proto.h
index f0350fa3f173..8a17350fee7c 100644
--- a/fs/smb/client/smb1proto.h
+++ b/fs/smb/client/smb1proto.h
@@ -209,7 +209,8 @@ ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
const unsigned char *ea_name, char *EAData,
size_t buf_size, struct cifs_sb_info *cifs_sb);
int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
- const char *fileName, const char *ea_name,
+ const char *fileName, bool open_reparse_point,
+ const char *ea_name,
const void *ea_value, const __u16 ea_value_len,
const struct nls_table *nls_codepage,
struct cifs_sb_info *cifs_sb);
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 583ab4c4d773..6de334e222f0 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -1188,7 +1188,8 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
static int
smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
- const char *path, const char *ea_name, const void *ea_value,
+ const char *path, bool open_reparse_point,
+ const char *ea_name, const void *ea_value,
const __u16 ea_value_len, const struct nls_table *nls_codepage,
struct cifs_sb_info *cifs_sb)
{
@@ -1290,7 +1291,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
.path = path,
.desired_access = FILE_WRITE_EA,
.disposition = FILE_OPEN,
- .create_options = cifs_create_options(cifs_sb, 0),
+ .create_options = cifs_create_options(cifs_sb,
+ open_reparse_point ? OPEN_REPARSE_POINT : 0),
.fid = &fid,
.replay = !!(retries),
};
diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
index 5091f6c0d7fe..93e4cc114d75 100644
--- a/fs/smb/client/xattr.c
+++ b/fs/smb/client/xattr.c
@@ -154,7 +154,8 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
if (pTcon->ses->server->ops->set_EA) {
rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
- full_path, name, value, (__u16)size,
+ full_path, false /* open reparse point */,
+ name, value, (__u16)size,
cifs_sb->local_nls, cifs_sb);
if (rc == 0)
inode_set_ctime_current(inode);
--
2.20.1
next prev parent reply other threads:[~2026-10-26 22:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 22:25 [PATCH v7.3 0/9] Various changes Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 1/9] cifs: Remove code for querying FILE_INFO_STANDARD via CIFSSMBQPathInfo() Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 2/9] cifs: Remove cifs_backup_query_path_info() and replace it by cifs_query_path_info() Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 3/9] cifs: Fix validation of EAs for WSL reparse points Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 4/9] cifs: Validate presence of EA $LXMOD " Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 5/9] cifs: Check if server supports EAs before trying to set it for WSL Pali Rohár
2026-10-26 22:25 ` Pali Rohár [this message]
2026-10-26 22:25 ` [PATCH v7.3 7/9] cifs: Create native Window socket file compatible also with WSL subsystem Pali Rohár
2026-10-26 22:25 ` [PATCH v7.3 8/9] cifs: Add support for parsing WSL symlinks in version 1 format Pali Rohár
2026-10-27 1:37 ` Namjae Jeon
2026-10-26 22:26 ` [PATCH v7.3 9/9] cifs: Add support for creating " Pali Rohár
2026-10-27 1:38 ` Namjae Jeon
2026-10-27 1:42 ` [PATCH v7.3 0/9] Various changes Namjae Jeon
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=20261026222600.17323-7-pali@kernel.org \
--to=pali@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pc@manguebit.org \
/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
all inboxes | Powered by JetHome®