aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven French <smfrench@gmail.com>2013-10-09 14:36:35 -0400
committerSteve French <smfrench@gmail.com>2013-11-02 13:52:38 -0400
commit2167114c6ea6e76fd84e368bae5389d37dd156aa (patch)
tree82c967e5b71698a7987f52434c429b2c19dccb35 /fs
parent7f48558e6489d032b1584b0cc9ac4bb11072c034 (diff)
Query device characteristics at mount time from server on SMB2/3 not just on cifs mounts
Currently SMB2 and SMB3 mounts do not query the device information at mount time from the server as is done for cifs. These can be useful for debugging. This is a minor patch, that extends the previous one (which added ability to query file system attributes at mount time - this returns the device characteristics - also via in /proc/fs/cifs/DebugData) Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/smb2ops.c5
-rw-r--r--fs/cifs/smb2pdu.c31
-rw-r--r--fs/cifs/smb2proto.h2
3 files changed, 28 insertions, 10 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index a53e2053ae9d..79084d67f3fb 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -229,7 +229,10 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
229 if (rc) 229 if (rc)
230 return; 230 return;
231 231
232 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid); 232 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
233 FS_ATTRIBUTE_INFORMATION);
234 SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
235 FS_DEVICE_INFORMATION);
233 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 236 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
234 return; 237 return;
235} 238}
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index df12cf8bd979..7887cf50e5fb 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2358,17 +2358,27 @@ qfsinf_exit:
2358 2358
2359int 2359int
2360SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, 2360SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
2361 u64 persistent_fid, u64 volatile_fid) 2361 u64 persistent_fid, u64 volatile_fid, int level)
2362{ 2362{
2363 struct smb2_query_info_rsp *rsp = NULL; 2363 struct smb2_query_info_rsp *rsp = NULL;
2364 struct kvec iov; 2364 struct kvec iov;
2365 int rc = 0; 2365 int rc = 0;
2366 int resp_buftype; 2366 int resp_buftype, max_len, min_len;
2367 struct cifs_ses *ses = tcon->ses; 2367 struct cifs_ses *ses = tcon->ses;
2368 unsigned int rsp_len, offset; 2368 unsigned int rsp_len, offset;
2369 2369
2370 rc = build_qfs_info_req(&iov, tcon, SMB_QUERY_FS_ATTRIBUTE_INFO, 2370 if (level == FS_DEVICE_INFORMATION) {
2371 sizeof(FILE_SYSTEM_ATTRIBUTE_INFO), 2371 max_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
2372 min_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
2373 } else if (level == FS_ATTRIBUTE_INFORMATION) {
2374 max_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO);
2375 min_len = MIN_FS_ATTR_INFO_SIZE;
2376 } else {
2377 cifs_dbg(FYI, "Invalid qfsinfo level %d", level);
2378 return -EINVAL;
2379 }
2380
2381 rc = build_qfs_info_req(&iov, tcon, level, max_len,
2372 persistent_fid, volatile_fid); 2382 persistent_fid, volatile_fid);
2373 if (rc) 2383 if (rc)
2374 return rc; 2384 return rc;
@@ -2382,12 +2392,17 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
2382 2392
2383 rsp_len = le32_to_cpu(rsp->OutputBufferLength); 2393 rsp_len = le32_to_cpu(rsp->OutputBufferLength);
2384 offset = le16_to_cpu(rsp->OutputBufferOffset); 2394 offset = le16_to_cpu(rsp->OutputBufferOffset);
2385 rc = validate_buf(offset, rsp_len, &rsp->hdr, MIN_FS_ATTR_INFO_SIZE); 2395 rc = validate_buf(offset, rsp_len, &rsp->hdr, min_len);
2386 if (!rc) { 2396 if (rc)
2397 goto qfsattr_exit;
2398
2399 if (level == FS_ATTRIBUTE_INFORMATION)
2387 memcpy(&tcon->fsAttrInfo, 4 /* RFC1001 len */ + offset 2400 memcpy(&tcon->fsAttrInfo, 4 /* RFC1001 len */ + offset
2388 + (char *)&rsp->hdr, min_t(unsigned int, 2401 + (char *)&rsp->hdr, min_t(unsigned int,
2389 rsp_len, sizeof(FILE_SYSTEM_ATTRIBUTE_INFO))); 2402 rsp_len, max_len));
2390 } 2403 else if (level == FS_DEVICE_INFORMATION)
2404 memcpy(&tcon->fsDevInfo, 4 /* RFC1001 len */ + offset
2405 + (char *)&rsp->hdr, sizeof(FILE_SYSTEM_DEVICE_INFO));
2391 2406
2392qfsattr_exit: 2407qfsattr_exit:
2393 free_rsp_buf(resp_buftype, iov.iov_base); 2408 free_rsp_buf(resp_buftype, iov.iov_base);
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 68dc00d5fb12..313813e4c19b 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -151,7 +151,7 @@ extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
151 u64 persistent_file_id, u64 volatile_file_id, 151 u64 persistent_file_id, u64 volatile_file_id,
152 struct kstatfs *FSData); 152 struct kstatfs *FSData);
153extern int SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, 153extern int SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
154 u64 persistent_file_id, u64 volatile_file_id); 154 u64 persistent_file_id, u64 volatile_file_id, int lvl);
155extern int SMB2_lock(const unsigned int xid, struct cifs_tcon *tcon, 155extern int SMB2_lock(const unsigned int xid, struct cifs_tcon *tcon,
156 const __u64 persist_fid, const __u64 volatile_fid, 156 const __u64 persist_fid, const __u64 volatile_fid,
157 const __u32 pid, const __u64 length, const __u64 offset, 157 const __u32 pid, const __u64 length, const __u64 offset,