diff mbox series

[SMB3] Add support for POSIX Extension info level on query info

Message ID CAH2r5mvJ3U_-EegHZwSPiaW7b8yA_PLqJhAHPdVJZE=5R8y=Qg@mail.gmail.com
State New
Headers show
Series [SMB3] Add support for POSIX Extension info level on query info | expand

Commit Message

Steve French June 12, 2020, 8:56 a.m. UTC
We were only using level 100 (posix info level) on query dir not the
compounded query file info.

Comments

Aurélien Aptel June 12, 2020, 10:56 a.m. UTC | #1
It looks good to me. Trying to unify all the query infos has proved to
be difficult with the different struct types, parameters and code being
done in each. So I guess having another func is ok.

We could have a func just doing a switch on all 3 funcs, as a first
follow up cleanup.

Some notes:
- Probably needs more thorough checks on buffer sizes
- UID-mapping is still TODO (also in my query dir code) and probably
  breaks with multi user mounts

Steve French <smfrench@gmail.com> writes:
> @@ -595,6 +596,62 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
>  #endif
>  }
>  
> +	/* The srv fs device id is overridden on network mount so setting rdev isn't needed here */
> +/*	fattr->cf_rdev = le32_to_cpu(info->DeviceId); */

Indentation.

Reviewed-by: Aurelien Aptel <aaptel@suse.com>

Cheers,
diff mbox series

Patch

From 1369daeda6c1d914fdba83a4b9627efbd8431abc Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Thu, 11 Jun 2020 20:23:38 -0500
Subject: [PATCH 2/5] smb311: Add support for SMB311 query info
 (non-compounded)

Add worker function for non-compounded SMB3.1.1 POSIX Extensions query info.
This is needed for revalidate of root (cached) directory for example.

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2pdu.c   | 13 +++++++++++++
 fs/cifs/smb2proto.h |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ded96b529a4d..a55a969673aa 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3456,6 +3456,19 @@  int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
 			  NULL);
 }
 
+int
+SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
+		u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen)
+{
+	size_t output_len = sizeof(struct smb311_posix_qinfo *) +
+			(sizeof(struct cifs_sid) * 2) + (PATH_MAX * 2);
+	*plen = 0;
+
+	return query_info(xid, tcon, persistent_fid, volatile_fid,
+			  SMB_FIND_FILE_POSIX_INFO, SMB2_O_INFO_FILE, 0,
+			  output_len, sizeof(struct smb311_posix_qinfo), (void **)&data, plen);
+}
+
 int
 SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
 		u64 persistent_fid, u64 volatile_fid,
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index a5c6da59847e..2f8ecbf54214 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -182,6 +182,8 @@  extern int SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
 			   struct TCP_Server_Info *server,
 			   u64 persistent_file_id, u64 volatile_file_id);
 extern void SMB2_flush_free(struct smb_rqst *rqst);
+extern int SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
+		u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen);
 extern int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
 			   u64 persistent_file_id, u64 volatile_file_id,
 			   struct smb2_file_all_info *data);
-- 
2.25.1