diff options
author | Steve French <stfrench@microsoft.com> | 2018-06-24 23:28:12 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-08-07 14:15:41 -0500 |
commit | 2d304217832ea720337e7a6aa012aa828a77f9d4 (patch) | |
tree | 387ab578484e9b1a48f140fd2a7fda4b6e44489b /fs/cifs/smb2ops.c | |
parent | 21ba3845b59c733a79ed4fe1c4f3732e7ece9df7 (diff) | |
download | linux-stable-2d304217832ea720337e7a6aa012aa828a77f9d4.tar.gz linux-stable-2d304217832ea720337e7a6aa012aa828a77f9d4.tar.bz2 linux-stable-2d304217832ea720337e7a6aa012aa828a77f9d4.zip |
smb3: add support for statfs for smb3.1.1 posix extensions
Output now matches expected stat -f output for all fields
except for Namelen and ID which were addressed in a companion
patch (which retrieves them from existing SMB3 mechanisms
and works whether POSIX enabled or not)
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 09506d918ecb..e2a8b9d90ad8 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -1533,6 +1533,39 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, return rc; } +#ifdef CONFIG_CIFS_SMB311 +static int +smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon, + struct kstatfs *buf) +{ + int rc; + __le16 srch_path = 0; /* Null - open root of share */ + u8 oplock = SMB2_OPLOCK_LEVEL_NONE; + struct cifs_open_parms oparms; + struct cifs_fid fid; + + if (!tcon->posix_extensions) + return smb2_queryfs(xid, tcon, buf); + + oparms.tcon = tcon; + oparms.desired_access = FILE_READ_ATTRIBUTES; + oparms.disposition = FILE_OPEN; + oparms.create_options = 0; + oparms.fid = &fid; + oparms.reconnect = false; + + rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, NULL); + if (rc) + return rc; + + rc = SMB311_posix_qfs_info(xid, tcon, fid.persistent_fid, + fid.volatile_fid, buf); + buf->f_type = SMB2_MAGIC_NUMBER; + SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); + return rc; +} +#endif /* SMB311 */ + static bool smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2) { @@ -3338,7 +3371,7 @@ struct smb_version_operations smb311_operations = { .is_status_pending = smb2_is_status_pending, .is_session_expired = smb2_is_session_expired, .oplock_response = smb2_oplock_response, - .queryfs = smb2_queryfs, + .queryfs = smb311_queryfs, .mand_lock = smb2_mand_lock, .mand_unlock_range = smb2_unlock_range, .push_mand_locks = smb2_push_mandatory_locks, |