public inbox for stable@vger.kernel.org
 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, kernel test robot <lkp@intel.com>,
	"Paulo Alcantara (SUSE)" <pc@manguebit.com>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6 014/102] smb: client: allow creating special files via reparse points
Date: Thu, 23 May 2024 15:12:39 +0200	[thread overview]
Message-ID: <20240523130343.002982940@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: Steve French <stfrench@microsoft.com>

[ Upstream commit 102466f303ffcd5cff207b3c122557f73f1041e6 ]

Add support for creating special files (e.g. char/block devices,
sockets, fifos) via NFS reparse points on SMB2+, which are fully
supported by most SMB servers and documented in MS-FSCC.

smb2_get_reparse_inode() creates the file with a corresponding reparse
point buffer set in @iov through a single roundtrip to the server.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311260746.HOJ039BV-lkp@intel.com/
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/cifsproto.h |  8 +++-
 fs/smb/client/dir.c       |  7 +--
 fs/smb/client/file.c      | 10 +++--
 fs/smb/client/inode.c     | 76 ++++++++++++++++++++-----------
 fs/smb/client/link.c      | 10 +++--
 fs/smb/client/smb2glob.h  | 25 ++++++-----
 fs/smb/client/smb2inode.c | 75 +++++++++++++++++++++++++++++++
 fs/smb/client/smb2ops.c   | 94 +++++++++++++++++++++++++++++++++++----
 fs/smb/client/smb2proto.h |  7 +++
 fs/smb/client/trace.h     |  4 +-
 10 files changed, 256 insertions(+), 60 deletions(-)

diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index 9480cdb9588d5..49de2545f34ce 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -213,8 +213,12 @@ int cifs_get_inode_info(struct inode **inode, const char *full_path,
 bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,
 				 struct cifs_fattr *fattr,
 				 struct cifs_open_info_data *data);
-extern int smb311_posix_get_inode_info(struct inode **pinode, const char *search_path,
-			struct super_block *sb, unsigned int xid);
+
+extern int smb311_posix_get_inode_info(struct inode **inode,
+				       const char *full_path,
+				       struct cifs_open_info_data *data,
+				       struct super_block *sb,
+				       const unsigned int xid);
 extern int cifs_get_inode_info_unix(struct inode **pinode,
 			const unsigned char *search_path,
 			struct super_block *sb, unsigned int xid);
diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
index 855468a32904e..37897b919dd5a 100644
--- a/fs/smb/client/dir.c
+++ b/fs/smb/client/dir.c
@@ -695,9 +695,10 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 		 full_path, d_inode(direntry));
 
 again:
-	if (pTcon->posix_extensions)
-		rc = smb311_posix_get_inode_info(&newInode, full_path, parent_dir_inode->i_sb, xid);
-	else if (pTcon->unix_ext) {
+	if (pTcon->posix_extensions) {
+		rc = smb311_posix_get_inode_info(&newInode, full_path, NULL,
+						 parent_dir_inode->i_sb, xid);
+	} else if (pTcon->unix_ext) {
 		rc = cifs_get_inode_info_unix(&newInode, full_path,
 					      parent_dir_inode->i_sb, xid);
 	} else {
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 53a8c633221b9..f41804245fca1 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -1102,14 +1102,16 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
 		if (!is_interrupt_error(rc))
 			mapping_set_error(inode->i_mapping, rc);
 
-		if (tcon->posix_extensions)
-			rc = smb311_posix_get_inode_info(&inode, full_path, inode->i_sb, xid);
-		else if (tcon->unix_ext)
+		if (tcon->posix_extensions) {
+			rc = smb311_posix_get_inode_info(&inode, full_path,
+							 NULL, inode->i_sb, xid);
+		} else if (tcon->unix_ext) {
 			rc = cifs_get_inode_info_unix(&inode, full_path,
 						      inode->i_sb, xid);
-		else
+		} else {
 			rc = cifs_get_inode_info(&inode, full_path, NULL,
 						 inode->i_sb, xid, NULL);
+		}
 	}
 	/*
 	 * Else we are writing out data to server already and could deadlock if
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index fa6330d586e89..391839feb29d5 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -1063,7 +1063,9 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
 				 const unsigned int xid,
 				 struct cifs_tcon *tcon,
 				 const char *full_path,
-				 struct cifs_fattr *fattr)
+				 struct cifs_fattr *fattr,
+				 struct cifs_sid *owner,
+				 struct cifs_sid *group)
 {
 	struct TCP_Server_Info *server = tcon->ses->server;
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -1094,7 +1096,8 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
 		rc = 0;
 		goto out;
 	default:
-		if (data->symlink_target) {
+		/* Check for cached reparse point data */
+		if (data->symlink_target || data->reparse.buf) {
 			rc = 0;
 		} else if (server->ops->parse_reparse_point) {
 			rc = server->ops->parse_reparse_point(cifs_sb,
@@ -1103,7 +1106,10 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
 		break;
 	}
 
-	cifs_open_info_to_fattr(fattr, data, sb);
+	if (tcon->posix_extensions)
+		smb311_posix_info_to_fattr(fattr, data, owner, group, sb);
+	else
+		cifs_open_info_to_fattr(fattr, data, sb);
 out:
 	fattr->cf_cifstag = data->reparse.tag;
 	free_rsp_buf(rsp_buftype, rsp_iov.iov_base);
@@ -1155,7 +1161,8 @@ static int cifs_get_fattr(struct cifs_open_info_data *data,
 		 */
 		if (cifs_open_data_reparse(data)) {
 			rc = reparse_info_to_fattr(data, sb, xid, tcon,
-						   full_path, fattr);
+						   full_path, fattr,
+						   NULL, NULL);
 		} else {
 			cifs_open_info_to_fattr(fattr, data, sb);
 		}
@@ -1293,18 +1300,19 @@ int cifs_get_inode_info(struct inode **inode,
 	return rc;
 }
 
-static int smb311_posix_get_fattr(struct cifs_fattr *fattr,
+static int smb311_posix_get_fattr(struct cifs_open_info_data *data,
+				  struct cifs_fattr *fattr,
 				  const char *full_path,
 				  struct super_block *sb,
 				  const unsigned int xid)
 {
-	struct cifs_open_info_data data = {};
+	struct cifs_open_info_data tmp_data = {};
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	struct cifs_tcon *tcon;
 	struct tcon_link *tlink;
 	struct cifs_sid owner, group;
 	int tmprc;
-	int rc;
+	int rc = 0;
 
 	tlink = cifs_sb_tlink(cifs_sb);
 	if (IS_ERR(tlink))
@@ -1312,12 +1320,14 @@ static int smb311_posix_get_fattr(struct cifs_fattr *fattr,
 	tcon = tlink_tcon(tlink);
 
 	/*
-	 * 1. Fetch file metadata
+	 * 1. Fetch file metadata if not provided (data)
 	 */
-
-	rc = smb311_posix_query_path_info(xid, tcon, cifs_sb,
-					  full_path, &data,
-					  &owner, &group);
+	if (!data) {
+		rc = smb311_posix_query_path_info(xid, tcon, cifs_sb,
+						  full_path, &tmp_data,
+						  &owner, &group);
+		data = &tmp_data;
+	}
 
 	/*
 	 * 2. Convert it to internal cifs metadata (fattr)
@@ -1325,7 +1335,14 @@ static int smb311_posix_get_fattr(struct cifs_fattr *fattr,
 
 	switch (rc) {
 	case 0:
-		smb311_posix_info_to_fattr(fattr, &data, &owner, &group, sb);
+		if (cifs_open_data_reparse(data)) {
+			rc = reparse_info_to_fattr(data, sb, xid, tcon,
+						   full_path, fattr,
+						   &owner, &group);
+		} else {
+			smb311_posix_info_to_fattr(fattr, data,
+						   &owner, &group, sb);
+		}
 		break;
 	case -EREMOTE:
 		/* DFS link, no metadata available on this server */
@@ -1356,12 +1373,15 @@ static int smb311_posix_get_fattr(struct cifs_fattr *fattr,
 
 out:
 	cifs_put_tlink(tlink);
-	cifs_free_open_info(&data);
+	cifs_free_open_info(data);
 	return rc;
 }
 
-int smb311_posix_get_inode_info(struct inode **inode, const char *full_path,
-				struct super_block *sb, const unsigned int xid)
+int smb311_posix_get_inode_info(struct inode **inode,
+				const char *full_path,
+				struct cifs_open_info_data *data,
+				struct super_block *sb,
+				const unsigned int xid)
 {
 	struct cifs_fattr fattr = {};
 	int rc;
@@ -1371,7 +1391,7 @@ int smb311_posix_get_inode_info(struct inode **inode, const char *full_path,
 		return 0;
 	}
 
-	rc = smb311_posix_get_fattr(&fattr, full_path, sb, xid);
+	rc = smb311_posix_get_fattr(data, &fattr, full_path, sb, xid);
 	if (rc)
 		goto out;
 
@@ -1521,7 +1541,7 @@ struct inode *cifs_root_iget(struct super_block *sb)
 
 	convert_delimiter(path, CIFS_DIR_SEP(cifs_sb));
 	if (tcon->posix_extensions)
-		rc = smb311_posix_get_fattr(&fattr, path, sb, xid);
+		rc = smb311_posix_get_fattr(NULL, &fattr, path, sb, xid);
 	else
 		rc = cifs_get_fattr(NULL, sb, xid, NULL, &fattr, &inode, path);
 
@@ -1894,16 +1914,18 @@ cifs_mkdir_qinfo(struct inode *parent, struct dentry *dentry, umode_t mode,
 	int rc = 0;
 	struct inode *inode = NULL;
 
-	if (tcon->posix_extensions)
-		rc = smb311_posix_get_inode_info(&inode, full_path, parent->i_sb, xid);
+	if (tcon->posix_extensions) {
+		rc = smb311_posix_get_inode_info(&inode, full_path,
+						 NULL, parent->i_sb, xid);
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-	else if (tcon->unix_ext)
+	} else if (tcon->unix_ext) {
 		rc = cifs_get_inode_info_unix(&inode, full_path, parent->i_sb,
 					      xid);
 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
-	else
+	} else {
 		rc = cifs_get_inode_info(&inode, full_path, NULL, parent->i_sb,
 					 xid, NULL);
+	}
 
 	if (rc)
 		return rc;
@@ -2585,13 +2607,15 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
 		 dentry, cifs_get_time(dentry), jiffies);
 
 again:
-	if (cifs_sb_master_tcon(CIFS_SB(sb))->posix_extensions)
-		rc = smb311_posix_get_inode_info(&inode, full_path, sb, xid);
-	else if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
+	if (cifs_sb_master_tcon(CIFS_SB(sb))->posix_extensions) {
+		rc = smb311_posix_get_inode_info(&inode, full_path,
+						 NULL, sb, xid);
+	} else if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext) {
 		rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
-	else
+	} else {
 		rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
 					 xid, NULL);
+	}
 	if (rc == -EAGAIN && count++ < 10)
 		goto again;
 out:
diff --git a/fs/smb/client/link.c b/fs/smb/client/link.c
index 3ef34218a790d..691f43a1ec2bc 100644
--- a/fs/smb/client/link.c
+++ b/fs/smb/client/link.c
@@ -614,14 +614,16 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
 					cifs_sb_target->local_nls); */
 
 	if (rc == 0) {
-		if (pTcon->posix_extensions)
-			rc = smb311_posix_get_inode_info(&newinode, full_path, inode->i_sb, xid);
-		else if (pTcon->unix_ext)
+		if (pTcon->posix_extensions) {
+			rc = smb311_posix_get_inode_info(&newinode, full_path,
+							 NULL, inode->i_sb, xid);
+		} else if (pTcon->unix_ext) {
 			rc = cifs_get_inode_info_unix(&newinode, full_path,
 						      inode->i_sb, xid);
-		else
+		} else {
 			rc = cifs_get_inode_info(&newinode, full_path, NULL,
 						 inode->i_sb, xid, NULL);
+		}
 
 		if (rc != 0) {
 			cifs_dbg(FYI, "Create symlink ok, getinodeinfo fail rc = %d\n",
diff --git a/fs/smb/client/smb2glob.h b/fs/smb/client/smb2glob.h
index 82e916ad167c0..ca87a0011c337 100644
--- a/fs/smb/client/smb2glob.h
+++ b/fs/smb/client/smb2glob.h
@@ -23,17 +23,20 @@
  * Identifiers for functions that use the open, operation, close pattern
  * in smb2inode.c:smb2_compound_op()
  */
-#define SMB2_OP_SET_DELETE 1
-#define SMB2_OP_SET_INFO 2
-#define SMB2_OP_QUERY_INFO 3
-#define SMB2_OP_QUERY_DIR 4
-#define SMB2_OP_MKDIR 5
-#define SMB2_OP_RENAME 6
-#define SMB2_OP_DELETE 7
-#define SMB2_OP_HARDLINK 8
-#define SMB2_OP_SET_EOF 9
-#define SMB2_OP_RMDIR 10
-#define SMB2_OP_POSIX_QUERY_INFO 11
+enum smb2_compound_ops {
+	SMB2_OP_SET_DELETE = 1,
+	SMB2_OP_SET_INFO,
+	SMB2_OP_QUERY_INFO,
+	SMB2_OP_QUERY_DIR,
+	SMB2_OP_MKDIR,
+	SMB2_OP_RENAME,
+	SMB2_OP_DELETE,
+	SMB2_OP_HARDLINK,
+	SMB2_OP_SET_EOF,
+	SMB2_OP_RMDIR,
+	SMB2_OP_POSIX_QUERY_INFO,
+	SMB2_OP_SET_REPARSE
+};
 
 /* Used when constructing chained read requests. */
 #define CHAINED_REQUEST 1
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 4c66187eccdd2..e74d3a1e49dfa 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -359,6 +359,22 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 			smb2_set_related(&rqst[num_rqst++]);
 			trace_smb3_hardlink_enter(xid, ses->Suid, tcon->tid, full_path);
 			break;
+		case SMB2_OP_SET_REPARSE:
+			rqst[num_rqst].rq_iov = vars->io_iov;
+			rqst[num_rqst].rq_nvec = ARRAY_SIZE(vars->io_iov);
+
+			rc = SMB2_ioctl_init(tcon, server, &rqst[num_rqst],
+					     COMPOUND_FID, COMPOUND_FID,
+					     FSCTL_SET_REPARSE_POINT,
+					     in_iov[i].iov_base,
+					     in_iov[i].iov_len, 0);
+			if (rc)
+				goto finished;
+			smb2_set_next_command(tcon, &rqst[num_rqst]);
+			smb2_set_related(&rqst[num_rqst++]);
+			trace_smb3_set_reparse_compound_enter(xid, ses->Suid,
+							      tcon->tid, full_path);
+			break;
 		default:
 			cifs_dbg(VFS, "Invalid command\n");
 			rc = -EINVAL;
@@ -515,6 +531,16 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 								  tcon->tid);
 			SMB2_set_info_free(&rqst[num_rqst++]);
 			break;
+		case SMB2_OP_SET_REPARSE:
+			if (rc) {
+				trace_smb3_set_reparse_compound_err(xid,  ses->Suid,
+								    tcon->tid, rc);
+			} else {
+				trace_smb3_set_reparse_compound_done(xid, ses->Suid,
+								     tcon->tid);
+			}
+			SMB2_ioctl_free(&rqst[num_rqst++]);
+			break;
 		}
 	}
 	SMB2_close_free(&rqst[num_rqst]);
@@ -905,3 +931,52 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
 	cifs_put_tlink(tlink);
 	return rc;
 }
+
+struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
+				     struct super_block *sb,
+				     const unsigned int xid,
+				     struct cifs_tcon *tcon,
+				     const char *full_path,
+				     struct kvec *iov)
+{
+	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
+	struct cifsFileInfo *cfile;
+	struct inode *new = NULL;
+	struct kvec in_iov[2];
+	int cmds[2];
+	int da, co, cd;
+	int rc;
+
+	da = SYNCHRONIZE | DELETE |
+		FILE_READ_ATTRIBUTES |
+		FILE_WRITE_ATTRIBUTES;
+	co = CREATE_NOT_DIR | OPEN_REPARSE_POINT;
+	cd = FILE_CREATE;
+	cmds[0] = SMB2_OP_SET_REPARSE;
+	in_iov[0] = *iov;
+	in_iov[1].iov_base = data;
+	in_iov[1].iov_len = sizeof(*data);
+
+	if (tcon->posix_extensions) {
+		cmds[1] = SMB2_OP_POSIX_QUERY_INFO;
+		cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
+		rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
+				      da, cd, co, ACL_NO_MODE, in_iov,
+				      cmds, 2, cfile, NULL, NULL, NULL, NULL);
+		if (!rc) {
+			rc = smb311_posix_get_inode_info(&new, full_path,
+							 data, sb, xid);
+		}
+	} else {
+		cmds[1] = SMB2_OP_QUERY_INFO;
+		cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
+		rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
+				      da, cd, co, ACL_NO_MODE, in_iov,
+				      cmds, 2, cfile, NULL, NULL, NULL, NULL);
+		if (!rc) {
+			rc = cifs_get_inode_info(&new, full_path,
+						 data, sb, xid, NULL);
+		}
+	}
+	return rc ? ERR_PTR(rc) : new;
+}
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 2b892a736e5f9..4fed19d5a81d4 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -5170,11 +5170,88 @@ int cifs_sfu_make_node(unsigned int xid, struct inode *inode,
 	return rc;
 }
 
+static inline u64 mode_nfs_type(mode_t mode)
+{
+	switch (mode & S_IFMT) {
+	case S_IFBLK: return NFS_SPECFILE_BLK;
+	case S_IFCHR: return NFS_SPECFILE_CHR;
+	case S_IFIFO: return NFS_SPECFILE_FIFO;
+	case S_IFSOCK: return NFS_SPECFILE_SOCK;
+	}
+	return 0;
+}
+
+static int nfs_set_reparse_buf(struct reparse_posix_data *buf,
+			       mode_t mode, dev_t dev,
+			       struct kvec *iov)
+{
+	u64 type;
+	u16 len, dlen;
+
+	len = sizeof(*buf);
+
+	switch ((type = mode_nfs_type(mode))) {
+	case NFS_SPECFILE_BLK:
+	case NFS_SPECFILE_CHR:
+		dlen = sizeof(__le64);
+		break;
+	case NFS_SPECFILE_FIFO:
+	case NFS_SPECFILE_SOCK:
+		dlen = 0;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	buf->ReparseTag = cpu_to_le32(IO_REPARSE_TAG_NFS);
+	buf->Reserved = 0;
+	buf->InodeType = cpu_to_le64(type);
+	buf->ReparseDataLength = cpu_to_le16(len + dlen -
+					     sizeof(struct reparse_data_buffer));
+	*(__le64 *)buf->DataBuffer = cpu_to_le64(((u64)MAJOR(dev) << 32) |
+						 MINOR(dev));
+	iov->iov_base = buf;
+	iov->iov_len = len + dlen;
+	return 0;
+}
+
+static int nfs_make_node(unsigned int xid, struct inode *inode,
+			 struct dentry *dentry, struct cifs_tcon *tcon,
+			 const char *full_path, umode_t mode, dev_t dev)
+{
+	struct cifs_open_info_data data;
+	struct reparse_posix_data *p;
+	struct inode *new;
+	struct kvec iov;
+	__u8 buf[sizeof(*p) + sizeof(__le64)];
+	int rc;
+
+	p = (struct reparse_posix_data *)buf;
+	rc = nfs_set_reparse_buf(p, mode, dev, &iov);
+	if (rc)
+		return rc;
+
+	data = (struct cifs_open_info_data) {
+		.reparse_point = true,
+		.reparse = { .tag = IO_REPARSE_TAG_NFS, .posix = p, },
+	};
+
+	new = smb2_get_reparse_inode(&data, inode->i_sb, xid,
+				     tcon, full_path, &iov);
+	if (!IS_ERR(new))
+		d_instantiate(dentry, new);
+	else
+		rc = PTR_ERR(new);
+	cifs_free_open_info(&data);
+	return rc;
+}
+
 static int smb2_make_node(unsigned int xid, struct inode *inode,
 			  struct dentry *dentry, struct cifs_tcon *tcon,
 			  const char *full_path, umode_t mode, dev_t dev)
 {
 	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	int rc;
 
 	/*
 	 * Check if mounted with mount parm 'sfu' mount parm.
@@ -5182,15 +5259,14 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
 	 * supports block and char device (no socket & fifo),
 	 * and was used by default in earlier versions of Windows
 	 */
-	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL))
-		return -EPERM;
-	/*
-	 * TODO: Add ability to create instead via reparse point. Windows (e.g.
-	 * their current NFS server) uses this approach to expose special files
-	 * over SMB2/SMB3 and Samba will do this with SMB3.1.1 POSIX Extensions
-	 */
-	return cifs_sfu_make_node(xid, inode, dentry, tcon,
-				  full_path, mode, dev);
+	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
+		rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
+					full_path, mode, dev);
+	} else {
+		rc = nfs_make_node(xid, inode, dentry, tcon,
+				   full_path, mode, dev);
+	}
+	return rc;
 }
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h
index a8084ce7fcbd2..efa2f8fe23449 100644
--- a/fs/smb/client/smb2proto.h
+++ b/fs/smb/client/smb2proto.h
@@ -56,6 +56,12 @@ extern int smb3_handle_read_data(struct TCP_Server_Info *server,
 extern int smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
 				struct cifs_sb_info *cifs_sb, const char *path,
 				__u32 *reparse_tag);
+struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
+				     struct super_block *sb,
+				     const unsigned int xid,
+				     struct cifs_tcon *tcon,
+				     const char *full_path,
+				     struct kvec *iov);
 int smb2_query_path_info(const unsigned int xid,
 			 struct cifs_tcon *tcon,
 			 struct cifs_sb_info *cifs_sb,
@@ -293,4 +299,5 @@ int smb311_posix_query_path_info(const unsigned int xid,
 int posix_info_parse(const void *beg, const void *end,
 		     struct smb2_posix_info_parsed *out);
 int posix_info_sid_size(const void *beg, const void *end);
+
 #endif			/* _SMB2PROTO_H */
diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h
index de199ec9f7263..34f507584274b 100644
--- a/fs/smb/client/trace.h
+++ b/fs/smb/client/trace.h
@@ -370,11 +370,11 @@ DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_reparse_compound_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter);
 
-
 DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
 	TP_PROTO(unsigned int xid,
 		__u32	tid,
@@ -408,6 +408,7 @@ DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_reparse_compound_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done);
@@ -451,6 +452,7 @@ DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_reparse_compound_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err);
-- 
2.43.0




  parent reply	other threads:[~2024-05-23 13:22 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 ` Greg Kroah-Hartman [this message]
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 ` [PATCH 6.6 075/102] ksmbd: add continuous availability share parameter Greg Kroah-Hartman
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=20240523130343.002982940@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=lkp@intel.com \
    --cc=patches@lists.linux.dev \
    --cc=pc@manguebit.com \
    --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