summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Carvalho <henrique.carvalho@suse.com>2024-11-14 15:29:37 -0300
committerHenrique Carvalho <henrique.carvalho@suse.com>2024-11-14 16:01:57 -0300
commit7e3961347e34e2c8034cce81b4a0988192777e94 (patch)
tree82f985c2aeb480e353fe95985543197ff8321ffd
parent17834418bc200cae3d8e1106df74eda027c0752c (diff)
downloadlinux-7e3961347e34e2c8034cce81b4a0988192777e94.tar.gz
linux-7e3961347e34e2c8034cce81b4a0988192777e94.tar.bz2
linux-7e3961347e34e2c8034cce81b4a0988192777e94.zip
smb: client: remove ->qfs_tcon op
Add genetic smb_qfs_tcon function for smb21, smb30 and smb311. Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
-rw-r--r--fs/smb/client/cifsglob.h3
-rw-r--r--fs/smb/client/connect.c4
-rw-r--r--fs/smb/client/smb2ops.c15
-rw-r--r--fs/smb/client/smb2proto.h1
4 files changed, 15 insertions, 8 deletions
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 86d5d6840e39..92ca5ed8e85d 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -280,9 +280,6 @@ struct smb_version_operations {
unsigned int epoch, bool *purge_cache);
/* set negotiated write size */
unsigned int (*negotiate_wsize)(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
- /* informational QFS call */
- void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *);
/* create directory */
int (*posix_mkdir)(const unsigned int xid, struct inode *inode,
umode_t mode, struct cifs_tcon *tcon,
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 6905ee3bfc6e..7968d025495e 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -3271,8 +3271,8 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)
tcon->unix_ext = 0; /* server does not support them */
/* do not care if a following call succeed - informational */
- if (!tcon->pipe && server->ops->qfs_tcon) {
- server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);
+ if (!tcon->pipe) {
+ smb_qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE) {
if (tcon->fsDevInfo.DeviceCharacteristics &
cpu_to_le32(FILE_READ_ONLY_DEVICE))
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 4d673c5f1e3f..fafdab06b681 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -896,6 +896,18 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
}
+void
+smb_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb)
+{
+ u16 protocol_id = tcon->ses->server->vals->protocol_id;
+ if (protocol_id >= SMB30_PROT_ID)
+ smb3_qfs_tcon(xid, tcon, cifs_sb);
+ else if (protocol_id == SMB21_PROT_ID)
+ smb2_qfs_tcon(xid, tcon, cifs_sb);
+ else
+ pr_warn_once("unsupported protocol id 0x%x\n", protocol_id);
+}
+
int smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb, const char *full_path)
{
@@ -5035,7 +5047,6 @@ struct smb_version_operations smb21_operations = {
/* send_cancel is missing */
.downgrade_oplock = smb2_downgrade_oplock,
.negotiate_wsize = smb2_negotiate_wsize,
- .qfs_tcon = smb2_qfs_tcon,
.queryfs = smb2_queryfs,
.calc_signature = smb2_calc_signature,
.parse_lease_buf = smb2_parse_lease_buf,
@@ -5044,7 +5055,6 @@ struct smb_version_operations smb21_operations = {
struct smb_version_operations smb30_operations = {
.downgrade_oplock = smb3_downgrade_oplock,
.negotiate_wsize = smb3_negotiate_wsize,
- .qfs_tcon = smb3_qfs_tcon,
/* WSL tags introduced long after smb2.1, enable for SMB3, 3.11 only */
.close_getattr = smb2_close_getattr,
.queryfs = smb2_queryfs,
@@ -5061,7 +5071,6 @@ struct smb_version_operations smb30_operations = {
struct smb_version_operations smb311_operations = {
.downgrade_oplock = smb3_downgrade_oplock,
.negotiate_wsize = smb3_negotiate_wsize,
- .qfs_tcon = smb3_qfs_tcon,
.posix_mkdir = smb311_posix_mkdir,
.close_getattr = smb2_close_getattr,
.queryfs = smb311_queryfs,
diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h
index 95a45cd379ba..957441d83607 100644
--- a/fs/smb/client/smb2proto.h
+++ b/fs/smb/client/smb2proto.h
@@ -54,6 +54,7 @@ struct smb3_fs_context;
*****************************************************************
*/
extern unsigned int smb_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
+extern void smb_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb);
extern int map_smb2_to_linux_error(char *buf, bool log_err);
extern int smb2_check_message(char *buf, unsigned int length,