Commit 9a005bea authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '5.18-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull more cifs updates from Steve French:

 - three fixes for big endian issues in how Persistent and Volatile file
   ids were stored

 - Various misc. fixes: including some for oops, 2 for ioctls, 1 for
   writeback

 - cleanup of how tcon (tree connection) status is tracked

 - Four changesets to move various duplicated protocol definitions
   (defined both in cifs.ko and ksmbd) into smbfs_common/smb2pdu.h

 - important performance improvement to use cached handles in some key
   compounding code paths (reduces numbers of opens/closes sent in some
   workloads)

 - fix to allow alternate DFS target to be used to retry on a failed i/o

* tag '5.18-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: fix NULL ptr dereference in smb2_ioctl_query_info()
  cifs: prevent bad output lengths in smb2_ioctl_query_info()
  smb3: fix ksmbd bigendian bug in oplock break, and move its struct to smbfs_common
  smb3: cleanup and clarify status of tree connections
  smb3: move defines for query info and query fsinfo to smbfs_common
  smb3: move defines for ioctl protocol header and SMB2 sizes to smbfs_common
  [smb3] move more common protocol header definitions to smbfs_common
  cifs: fix incorrect use of list iterator after the loop
  ksmbd: store fids as opaque u64 integers
  cifs: fix bad fids sent over wire
  cifs: change smb2_query_info_compound to use a cached fid, if available
  cifs: convert the path to utf16 in smb2_query_info_compound
  cifs: writeback fix
  cifs: do not skip link targets when an I/O fails
parents ec251f3e d6f5e358
...@@ -94,7 +94,7 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon) ...@@ -94,7 +94,7 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
le32_to_cpu(tcon->fsAttrInfo.Attributes), le32_to_cpu(tcon->fsAttrInfo.Attributes),
le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
tcon->tidStatus); tcon->status);
if (dev_type == FILE_DEVICE_DISK) if (dev_type == FILE_DEVICE_DISK)
seq_puts(m, " type: DISK "); seq_puts(m, " type: DISK ");
else if (dev_type == FILE_DEVICE_CD_ROM) else if (dev_type == FILE_DEVICE_CD_ROM)
......
...@@ -699,14 +699,14 @@ static void cifs_umount_begin(struct super_block *sb) ...@@ -699,14 +699,14 @@ static void cifs_umount_begin(struct super_block *sb)
tcon = cifs_sb_master_tcon(cifs_sb); tcon = cifs_sb_master_tcon(cifs_sb);
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) { if ((tcon->tc_count > 1) || (tcon->status == TID_EXITING)) {
/* we have other mounts to same share or we have /* we have other mounts to same share or we have
already tried to force umount this and woken up already tried to force umount this and woken up
all waiting network requests, nothing to do */ all waiting network requests, nothing to do */
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
return; return;
} else if (tcon->tc_count == 1) } else if (tcon->tc_count == 1)
tcon->tidStatus = CifsExiting; tcon->status = TID_EXITING;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ /* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
......
...@@ -116,10 +116,18 @@ enum statusEnum { ...@@ -116,10 +116,18 @@ enum statusEnum {
CifsInNegotiate, CifsInNegotiate,
CifsNeedSessSetup, CifsNeedSessSetup,
CifsInSessSetup, CifsInSessSetup,
CifsNeedTcon, };
CifsInTcon,
CifsNeedFilesInvalidate, /* associated with each tree connection to the server */
CifsInFilesInvalidate enum tid_status_enum {
TID_NEW = 0,
TID_GOOD,
TID_EXITING,
TID_NEED_RECON,
TID_NEED_TCON,
TID_IN_TCON,
TID_NEED_FILES_INVALIDATE, /* currently unused */
TID_IN_FILES_INVALIDATE
}; };
enum securityEnum { enum securityEnum {
...@@ -853,13 +861,7 @@ compare_mid(__u16 mid, const struct smb_hdr *smb) ...@@ -853,13 +861,7 @@ compare_mid(__u16 mid, const struct smb_hdr *smb)
#define CIFS_MAX_RFC1002_WSIZE ((1<<17) - 1 - sizeof(WRITE_REQ) + 4) #define CIFS_MAX_RFC1002_WSIZE ((1<<17) - 1 - sizeof(WRITE_REQ) + 4)
#define CIFS_MAX_RFC1002_RSIZE ((1<<17) - 1 - sizeof(READ_RSP) + 4) #define CIFS_MAX_RFC1002_RSIZE ((1<<17) - 1 - sizeof(READ_RSP) + 4)
/*
* The default wsize is 1M. find_get_pages seems to return a maximum of 256
* pages in a single call. With PAGE_SIZE == 4k, this means we can fill
* a single wsize request with a single call.
*/
#define CIFS_DEFAULT_IOSIZE (1024 * 1024) #define CIFS_DEFAULT_IOSIZE (1024 * 1024)
#define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024)
/* /*
* Windows only supports a max of 60kb reads and 65535 byte writes. Default to * Windows only supports a max of 60kb reads and 65535 byte writes. Default to
...@@ -1039,7 +1041,7 @@ struct cifs_tcon { ...@@ -1039,7 +1041,7 @@ struct cifs_tcon {
char *password; /* for share-level security */ char *password; /* for share-level security */
__u32 tid; /* The 4 byte tree id */ __u32 tid; /* The 4 byte tree id */
__u16 Flags; /* optional support bits */ __u16 Flags; /* optional support bits */
enum statusEnum tidStatus; enum tid_status_enum status;
atomic_t num_smbs_sent; atomic_t num_smbs_sent;
union { union {
struct { struct {
......
...@@ -123,18 +123,6 @@ ...@@ -123,18 +123,6 @@
*/ */
#define CIFS_SESS_KEY_SIZE (16) #define CIFS_SESS_KEY_SIZE (16)
/*
* Size of the smb3 signing key
*/
#define SMB3_SIGN_KEY_SIZE (16)
/*
* Size of the smb3 encryption/decryption key storage.
* This size is big enough to store any cipher key types.
*/
#define SMB3_ENC_DEC_KEY_SIZE (32)
#define CIFS_CLIENT_CHALLENGE_SIZE (8)
#define CIFS_SERVER_CHALLENGE_SIZE (8) #define CIFS_SERVER_CHALLENGE_SIZE (8)
#define CIFS_HMAC_MD5_HASH_SIZE (16) #define CIFS_HMAC_MD5_HASH_SIZE (16)
#define CIFS_CPHTXT_SIZE (16) #define CIFS_CPHTXT_SIZE (16)
...@@ -1658,7 +1646,7 @@ struct smb_t2_rsp { ...@@ -1658,7 +1646,7 @@ struct smb_t2_rsp {
#define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105 #define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105
#define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106 #define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106
#define SMB_FIND_FILE_UNIX 0x202 #define SMB_FIND_FILE_UNIX 0x202
#define SMB_FIND_FILE_POSIX_INFO 0x064 /* #define SMB_FIND_FILE_POSIX_INFO 0x064 */
typedef struct smb_com_transaction2_qpi_req { typedef struct smb_com_transaction2_qpi_req {
struct smb_hdr hdr; /* wct = 14+ */ struct smb_hdr hdr; /* wct = 14+ */
......
...@@ -75,12 +75,11 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon) ...@@ -75,12 +75,11 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
/* only send once per connect */ /* only send once per connect */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->ses->status != CifsGood || if ((tcon->ses->status != CifsGood) || (tcon->status != TID_NEED_RECON)) {
tcon->tidStatus != CifsNeedReconnect) {
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
return; return;
} }
tcon->tidStatus = CifsInFilesInvalidate; tcon->status = TID_IN_FILES_INVALIDATE;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
/* list all files open on tree connection and mark them invalid */ /* list all files open on tree connection and mark them invalid */
...@@ -100,8 +99,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon) ...@@ -100,8 +99,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
mutex_unlock(&tcon->crfid.fid_mutex); mutex_unlock(&tcon->crfid.fid_mutex);
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInFilesInvalidate) if (tcon->status == TID_IN_FILES_INVALIDATE)
tcon->tidStatus = CifsNeedTcon; tcon->status = TID_NEED_TCON;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
/* /*
...@@ -136,7 +135,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command) ...@@ -136,7 +135,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* have tcon) are allowed as we start force umount * have tcon) are allowed as we start force umount
*/ */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsExiting) { if (tcon->status == TID_EXITING) {
if (smb_command != SMB_COM_WRITE_ANDX && if (smb_command != SMB_COM_WRITE_ANDX &&
smb_command != SMB_COM_OPEN_ANDX && smb_command != SMB_COM_OPEN_ANDX &&
smb_command != SMB_COM_TREE_DISCONNECT) { smb_command != SMB_COM_TREE_DISCONNECT) {
......
...@@ -245,7 +245,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, ...@@ -245,7 +245,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
tcon->need_reconnect = true; tcon->need_reconnect = true;
tcon->tidStatus = CifsNeedReconnect; tcon->status = TID_NEED_RECON;
} }
if (ses->tcon_ipc) if (ses->tcon_ipc)
ses->tcon_ipc->need_reconnect = true; ses->tcon_ipc->need_reconnect = true;
...@@ -2207,7 +2207,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) ...@@ -2207,7 +2207,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
{ {
if (tcon->tidStatus == CifsExiting) if (tcon->status == TID_EXITING)
return 0; return 0;
if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE)) if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE))
return 0; return 0;
...@@ -3513,6 +3513,9 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path, ...@@ -3513,6 +3513,9 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path,
struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb; struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
char *oldmnt = cifs_sb->ctx->mount_options; char *oldmnt = cifs_sb->ctx->mount_options;
cifs_dbg(FYI, "%s: full_path=%s ref_path=%s target=%s\n", __func__, full_path, ref_path,
dfs_cache_get_tgt_name(tit));
rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref); rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref);
if (rc) if (rc)
goto out; goto out;
...@@ -3611,13 +3614,18 @@ static int __follow_dfs_link(struct mount_ctx *mnt_ctx) ...@@ -3611,13 +3614,18 @@ static int __follow_dfs_link(struct mount_ctx *mnt_ctx)
if (rc) if (rc)
goto out; goto out;
/* Try all dfs link targets */ /* Try all dfs link targets. If an I/O fails from currently connected DFS target with an
* error other than STATUS_PATH_NOT_COVERED (-EREMOTE), then retry it from other targets as
* specified in MS-DFSC "3.1.5.2 I/O Operation to Target Fails with an Error Other Than
* STATUS_PATH_NOT_COVERED."
*/
for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl); for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl);
tit; tit = dfs_cache_get_next_tgt(&tl, tit)) { tit; tit = dfs_cache_get_next_tgt(&tl, tit)) {
rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit); rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit);
if (!rc) { if (!rc) {
rc = is_path_remote(mnt_ctx); rc = is_path_remote(mnt_ctx);
break; if (!rc || rc == -EREMOTE)
break;
} }
} }
...@@ -3691,7 +3699,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) ...@@ -3691,7 +3699,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
goto error; goto error;
rc = is_path_remote(&mnt_ctx); rc = is_path_remote(&mnt_ctx);
if (rc == -EREMOTE) if (rc)
rc = follow_dfs_link(&mnt_ctx); rc = follow_dfs_link(&mnt_ctx);
if (rc) if (rc)
goto error; goto error;
...@@ -4478,12 +4486,12 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru ...@@ -4478,12 +4486,12 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */ /* only send once per connect */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->ses->status != CifsGood || if (tcon->ses->status != CifsGood ||
(tcon->tidStatus != CifsNew && (tcon->status != TID_NEW &&
tcon->tidStatus != CifsNeedTcon)) { tcon->status != TID_NEED_TCON)) {
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
return 0; return 0;
} }
tcon->tidStatus = CifsInTcon; tcon->status = TID_IN_TCON;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL); tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
...@@ -4524,13 +4532,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru ...@@ -4524,13 +4532,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
if (rc) { if (rc) {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon) if (tcon->status == TID_IN_TCON)
tcon->tidStatus = CifsNeedTcon; tcon->status = TID_NEED_TCON;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
} else { } else {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon) if (tcon->status == TID_IN_TCON)
tcon->tidStatus = CifsGood; tcon->status = TID_GOOD;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
tcon->need_reconnect = false; tcon->need_reconnect = false;
} }
...@@ -4546,24 +4554,24 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru ...@@ -4546,24 +4554,24 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */ /* only send once per connect */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->ses->status != CifsGood || if (tcon->ses->status != CifsGood ||
(tcon->tidStatus != CifsNew && (tcon->status != TID_NEW &&
tcon->tidStatus != CifsNeedTcon)) { tcon->status != TID_NEED_TCON)) {
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
return 0; return 0;
} }
tcon->tidStatus = CifsInTcon; tcon->status = TID_IN_TCON;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc); rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) { if (rc) {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon) if (tcon->status == TID_IN_TCON)
tcon->tidStatus = CifsNeedTcon; tcon->status = TID_NEED_TCON;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
} else { } else {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon) if (tcon->status == TID_IN_TCON)
tcon->tidStatus = CifsGood; tcon->status = TID_GOOD;
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
tcon->need_reconnect = false; tcon->need_reconnect = false;
} }
......
...@@ -4210,13 +4210,19 @@ cifs_page_mkwrite(struct vm_fault *vmf) ...@@ -4210,13 +4210,19 @@ cifs_page_mkwrite(struct vm_fault *vmf)
{ {
struct page *page = vmf->page; struct page *page = vmf->page;
/* Wait for the page to be written to the cache before we allow it to
* be modified. We then assume the entire page will need writing back.
*/
#ifdef CONFIG_CIFS_FSCACHE #ifdef CONFIG_CIFS_FSCACHE
if (PageFsCache(page) && if (PageFsCache(page) &&
wait_on_page_fscache_killable(page) < 0) wait_on_page_fscache_killable(page) < 0)
return VM_FAULT_RETRY; return VM_FAULT_RETRY;
#endif #endif
lock_page(page); wait_on_page_writeback(page);
if (lock_page_killable(page) < 0)
return VM_FAULT_RETRY;
return VM_FAULT_LOCKED; return VM_FAULT_LOCKED;
} }
......
...@@ -116,7 +116,7 @@ tconInfoAlloc(void) ...@@ -116,7 +116,7 @@ tconInfoAlloc(void)
} }
atomic_inc(&tconInfoAllocCount); atomic_inc(&tconInfoAllocCount);
ret_buf->tidStatus = CifsNew; ret_buf->status = TID_NEW;
++ret_buf->tc_count; ++ret_buf->tc_count;
INIT_LIST_HEAD(&ret_buf->openFileList); INIT_LIST_HEAD(&ret_buf->openFileList);
INIT_LIST_HEAD(&ret_buf->tcon_list); INIT_LIST_HEAD(&ret_buf->tcon_list);
......
...@@ -41,15 +41,4 @@ ...@@ -41,15 +41,4 @@
#define END_OF_CHAIN 4 #define END_OF_CHAIN 4
#define RELATED_REQUEST 8 #define RELATED_REQUEST 8
#define SMB2_SIGNATURE_SIZE (16)
#define SMB2_NTLMV2_SESSKEY_SIZE (16)
#define SMB2_HMACSHA256_SIZE (32)
#define SMB2_CMACAES_SIZE (16)
#define SMB3_SIGNKEY_SIZE (16)
#define SMB3_GCM128_CRYPTKEY_SIZE (16)
#define SMB3_GCM256_CRYPTKEY_SIZE (32)
/* Maximum buffer size value we can send with 1 credit */
#define SMB2_MAX_BUFFER_SIZE 65536
#endif /* _SMB2_GLOB_H */ #endif /* _SMB2_GLOB_H */
...@@ -203,7 +203,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr) ...@@ -203,7 +203,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
if (smb2_rsp_struct_sizes[command] != pdu->StructureSize2) { if (smb2_rsp_struct_sizes[command] != pdu->StructureSize2) {
if (command != SMB2_OPLOCK_BREAK_HE && (shdr->Status == 0 || if (command != SMB2_OPLOCK_BREAK_HE && (shdr->Status == 0 ||
pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2)) { pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2_LE)) {
/* error packets have 9 byte structure size */ /* error packets have 9 byte structure size */
cifs_dbg(VFS, "Invalid response size %u for command %d\n", cifs_dbg(VFS, "Invalid response size %u for command %d\n",
le16_to_cpu(pdu->StructureSize2), command); le16_to_cpu(pdu->StructureSize2), command);
...@@ -303,7 +303,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr) ...@@ -303,7 +303,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr)
/* error responses do not have data area */ /* error responses do not have data area */
if (shdr->Status && shdr->Status != STATUS_MORE_PROCESSING_REQUIRED && if (shdr->Status && shdr->Status != STATUS_MORE_PROCESSING_REQUIRED &&
(((struct smb2_err_rsp *)shdr)->StructureSize) == (((struct smb2_err_rsp *)shdr)->StructureSize) ==
SMB2_ERROR_STRUCTURE_SIZE2) SMB2_ERROR_STRUCTURE_SIZE2_LE)
return NULL; return NULL;
/* /*
...@@ -478,11 +478,11 @@ smb2_get_lease_state(struct cifsInodeInfo *cinode) ...@@ -478,11 +478,11 @@ smb2_get_lease_state(struct cifsInodeInfo *cinode)
__le32 lease = 0; __le32 lease = 0;
if (CIFS_CACHE_WRITE(cinode)) if (CIFS_CACHE_WRITE(cinode))
lease |= SMB2_LEASE_WRITE_CACHING; lease |= SMB2_LEASE_WRITE_CACHING_LE;
if (CIFS_CACHE_HANDLE(cinode)) if (CIFS_CACHE_HANDLE(cinode))
lease |= SMB2_LEASE_HANDLE_CACHING; lease |= SMB2_LEASE_HANDLE_CACHING_LE;
if (CIFS_CACHE_READ(cinode)) if (CIFS_CACHE_READ(cinode))
lease |= SMB2_LEASE_READ_CACHING; lease |= SMB2_LEASE_READ_CACHING_LE;
return lease; return lease;
} }
...@@ -832,8 +832,8 @@ smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *serve ...@@ -832,8 +832,8 @@ smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *serve
rc = __smb2_handle_cancelled_cmd(tcon, rc = __smb2_handle_cancelled_cmd(tcon,
le16_to_cpu(hdr->Command), le16_to_cpu(hdr->Command),
le64_to_cpu(hdr->MessageId), le64_to_cpu(hdr->MessageId),
le64_to_cpu(rsp->PersistentFileId), rsp->PersistentFileId,
le64_to_cpu(rsp->VolatileFileId)); rsp->VolatileFileId);
if (rc) if (rc)
cifs_put_tcon(tcon); cifs_put_tcon(tcon);
......
This diff is collapsed.
...@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, ...@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
return 0; return 0;
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsExiting) { if (tcon->status == TID_EXITING) {
/* /*
* only tree disconnect, open, and write, * only tree disconnect, open, and write,
* (and ulogoff which does not have tcon) * (and ulogoff which does not have tcon)
...@@ -2734,13 +2734,10 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, ...@@ -2734,13 +2734,10 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
goto err_free_req; goto err_free_req;
} }
trace_smb3_posix_mkdir_done(xid, le64_to_cpu(rsp->PersistentFileId), trace_smb3_posix_mkdir_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
tcon->tid, CREATE_NOT_FILE, FILE_WRITE_ATTRIBUTES);
ses->Suid, CREATE_NOT_FILE,
FILE_WRITE_ATTRIBUTES);
SMB2_close(xid, tcon, le64_to_cpu(rsp->PersistentFileId), SMB2_close(xid, tcon, rsp->PersistentFileId, rsp->VolatileFileId);
le64_to_cpu(rsp->VolatileFileId));
/* Eventually save off posix specific response info and timestaps */ /* Eventually save off posix specific response info and timestaps */
...@@ -3009,14 +3006,12 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, ...@@ -3009,14 +3006,12 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
} else if (rsp == NULL) /* unlikely to happen, but safer to check */ } else if (rsp == NULL) /* unlikely to happen, but safer to check */
goto creat_exit; goto creat_exit;
else else
trace_smb3_open_done(xid, le64_to_cpu(rsp->PersistentFileId), trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
tcon->tid, oparms->create_options, oparms->desired_access);
ses->Suid, oparms->create_options,
oparms->desired_access);
atomic_inc(&tcon->num_remote_opens); atomic_inc(&tcon->num_remote_opens);
oparms->fid->persistent_fid = le64_to_cpu(rsp->PersistentFileId); oparms->fid->persistent_fid = rsp->PersistentFileId;
oparms->fid->volatile_fid = le64_to_cpu(rsp->VolatileFileId); oparms->fid->volatile_fid = rsp->VolatileFileId;
oparms->fid->access = oparms->desired_access; oparms->fid->access = oparms->desired_access;
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
oparms->fid->mid = le64_to_cpu(rsp->hdr.MessageId); oparms->fid->mid = le64_to_cpu(rsp->hdr.MessageId);
...@@ -3313,8 +3308,8 @@ SMB2_close_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, ...@@ -3313,8 +3308,8 @@ SMB2_close_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
if (rc) if (rc)
return rc; return rc;
req->PersistentFileId = cpu_to_le64(persistent_fid); req->PersistentFileId = persistent_fid;
req->VolatileFileId = cpu_to_le64(volatile_fid); req->VolatileFileId = volatile_fid;
if (query_attrs) if (query_attrs)
req->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB; req->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB;
else else
...@@ -3677,8 +3672,8 @@ SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst, ...@@ -3677,8 +3672,8 @@ SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst,
if (rc) if (rc)
return rc; return rc;
req->PersistentFileId = cpu_to_le64(persistent_fid); req->PersistentFileId = persistent_fid;
req->VolatileFileId = cpu_to_le64(volatile_fid); req->VolatileFileId = volatile_fid;
/* See note 354 of MS-SMB2, 64K max */ /* See note 354 of MS-SMB2, 64K max */
req->OutputBufferLength = req->OutputBufferLength =
cpu_to_le32(SMB2_MAX_BUFFER_SIZE - MAX_SMB2_HDR_SIZE); cpu_to_le32(SMB2_MAX_BUFFER_SIZE - MAX_SMB2_HDR_SIZE);
...@@ -3858,12 +3853,14 @@ void smb2_reconnect_server(struct work_struct *work) ...@@ -3858,12 +3853,14 @@ void smb2_reconnect_server(struct work_struct *work)
tcon = kzalloc(sizeof(struct cifs_tcon), GFP_KERNEL); tcon = kzalloc(sizeof(struct cifs_tcon), GFP_KERNEL);
if (!tcon) { if (!tcon) {
resched = true; resched = true;
list_del_init(&ses->rlist); list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
cifs_put_smb_ses(ses); list_del_init(&ses->rlist);
cifs_put_smb_ses(ses);
}
goto done; goto done;
} }
tcon->tidStatus = CifsGood; tcon->status = TID_GOOD;
tcon->retry = false; tcon->retry = false;
tcon->need_reconnect = false; tcon->need_reconnect = false;
...@@ -3951,8 +3948,8 @@ SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst, ...@@ -3951,8 +3948,8 @@ SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
if (rc) if (rc)
return rc; return rc;
req->PersistentFileId = cpu_to_le64(persistent_fid); req->PersistentFileId = persistent_fid;
req->VolatileFileId = cpu_to_le64(volatile_fid); req->VolatileFileId = volatile_fid;
iov[0].iov_base = (char *)req; iov[0].iov_base = (char *)req;
iov[0].iov_len = total_len; iov[0].iov_len = total_len;
...@@ -4033,8 +4030,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len, ...@@ -4033,8 +4030,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
shdr = &req->hdr; shdr = &req->hdr;
shdr->Id.SyncId.ProcessId = cpu_to_le32(io_parms->pid); shdr->Id.SyncId.ProcessId = cpu_to_le32(io_parms->pid);
req->PersistentFileId = cpu_to_le64(io_parms->persistent_fid); req->PersistentFileId = io_parms->persistent_fid;
req->VolatileFileId = cpu_to_le64(io_parms->volatile_fid); req->VolatileFileId = io_parms->volatile_fid;
req->ReadChannelInfoOffset = 0; /* reserved */ req->ReadChannelInfoOffset = 0; /* reserved */
req->ReadChannelInfoLength = 0; /* reserved */ req->ReadChannelInfoLength = 0; /* reserved */
req->Channel = 0; /* reserved */ req->Channel = 0; /* reserved */
...@@ -4094,8 +4091,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len, ...@@ -4094,8 +4091,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
*/ */
shdr->SessionId = cpu_to_le64(0xFFFFFFFFFFFFFFFF); shdr->SessionId = cpu_to_le64(0xFFFFFFFFFFFFFFFF);
shdr->Id.SyncId.TreeId = cpu_to_le32(0xFFFFFFFF); shdr->Id.SyncId.TreeId = cpu_to_le32(0xFFFFFFFF);
req->PersistentFileId = cpu_to_le64(0xFFFFFFFFFFFFFFFF); req->PersistentFileId = (u64)-1;
req->VolatileFileId = cpu_to_le64(0xFFFFFFFFFFFFFFFF); req->VolatileFileId = (u64)-1;
} }
} }
if (remaining_bytes > io_parms->length) if (remaining_bytes > io_parms->length)
...@@ -4307,21 +4304,19 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, ...@@ -4307,21 +4304,19 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE); cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);
cifs_dbg(VFS, "Send error in read = %d\n", rc); cifs_dbg(VFS, "Send error in read = %d\n", rc);
trace_smb3_read_err(xid, trace_smb3_read_err(xid,
le64_to_cpu(req->PersistentFileId), req->PersistentFileId,
io_parms->tcon->tid, ses->Suid, io_parms->tcon->tid, ses->Suid,
io_parms->offset, io_parms->length, io_parms->offset, io_parms->length,
rc); rc);
} else } else
trace_smb3_read_done(xid, trace_smb3_read_done(xid, req->PersistentFileId, io_parms->tcon->tid,
le64_to_cpu(req->PersistentFileId), ses->Suid, io_parms->offset, 0);
io_parms->tcon->tid, ses->Suid,
io_parms->offset, 0);
free_rsp_buf(resp_buftype, rsp_iov.iov_base); free_rsp_buf(resp_buftype, rsp_iov.iov_base);
cifs_small_buf_release(req); cifs_small_buf_release(req);
return rc == -ENODATA ? 0 : rc; return rc == -ENODATA ? 0 : rc;
} else } else
trace_smb3_read_done(xid, trace_smb3_read_done(xid,
le64_to_cpu(req->PersistentFileId), req->PersistentFileId,
io_parms->tcon->tid, ses->Suid, io_parms->tcon->tid, ses->Suid,
io_parms->offset, io_parms->length); io_parms->offset, io_parms->length);
...@@ -4463,8 +4458,8 @@ smb2_async_writev(struct cifs_writedata *wdata, ...@@ -4463,8 +4458,8 @@ smb2_async_writev(struct cifs_writedata *wdata,
shdr = (struct smb2_hdr *)req; shdr = (struct smb2_hdr *)req;
shdr->Id.SyncId.ProcessId = cpu_to_le32(wdata->cfile->pid); shdr->Id.SyncId.ProcessId = cpu_to_le32(wdata->cfile->pid);
req->PersistentFileId = cpu_to_le64(wdata->cfile->fid.persistent_fid); req->PersistentFileId = wdata->cfile->fid.persistent_fid;
req->VolatileFileId = cpu_to_le64(wdata->cfile->fid.volatile_fid); req->VolatileFileId = wdata->cfile->fid.volatile_fid;
req->WriteChannelInfoOffset = 0; req->WriteChannelInfoOffset = 0;
req->WriteChannelInfoLength = 0; req->WriteChannelInfoLength = 0;
req->Channel = 0; req->Channel = 0;
...@@ -4562,7 +4557,7 @@ smb2_async_writev(struct cifs_writedata *wdata, ...@@ -4562,7 +4557,7 @@ smb2_async_writev(struct cifs_writedata *wdata,
if (rc) { if (rc) {
trace_smb3_write_err(0 /* no xid */, trace_smb3_write_err(0 /* no xid */,
le64_to_cpu(req->PersistentFileId), req->PersistentFileId,
tcon->tid, tcon->ses->Suid, wdata->offset, tcon->tid, tcon->ses->Suid, wdata->offset,
wdata->bytes, rc); wdata->bytes, rc);
kref_put(&wdata->refcount, release); kref_put(&wdata->refcount, release);
...@@ -4615,8 +4610,8 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, ...@@ -4615,8 +4610,8 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
req->hdr.Id.SyncId.ProcessId = cpu_to_le32(io_parms->pid); req->hdr.Id.SyncId.ProcessId = cpu_to_le32(io_parms->pid);
req->PersistentFileId = cpu_to_le64(io_parms->persistent_fid); req->PersistentFileId = io_parms->persistent_fid;
req->VolatileFileId = cpu_to_le64(io_parms->volatile_fid); req->VolatileFileId = io_parms->volatile_fid;
req->WriteChannelInfoOffset = 0; req->WriteChannelInfoOffset = 0;
req->WriteChannelInfoLength = 0; req->WriteChannelInfoLength = 0;
req->Channel = 0; req->Channel = 0;
...@@ -4645,7 +4640,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, ...@@ -4645,7 +4640,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
if (rc) { if (rc) {
trace_smb3_write_err(xid, trace_smb3_write_err(xid,
le64_to_cpu(req->PersistentFileId), req->PersistentFileId,
io_parms->tcon->tid, io_parms->tcon->tid,
io_parms->tcon->ses->Suid, io_parms->tcon->ses->Suid,
io_parms->offset, io_parms->length, rc); io_parms->offset, io_parms->length, rc);
...@@ -4654,7 +4649,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, ...@@ -4654,7 +4649,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
} else { } else {
*nbytes = le32_to_cpu(rsp->DataLength); *nbytes = le32_to_cpu(rsp->DataLength);
trace_smb3_write_done(xid, trace_smb3_write_done(xid,
le64_to_cpu(req->PersistentFileId), req->PersistentFileId,
io_parms->tcon->tid, io_parms->tcon->tid,
io_parms->tcon->ses->Suid, io_parms->tcon->ses->Suid,
io_parms->offset, *nbytes); io_parms->offset, *nbytes);
......
This diff is collapsed.
...@@ -283,7 +283,7 @@ extern int smb311_update_preauth_hash(struct cifs_ses *ses, ...@@ -283,7 +283,7 @@ extern int smb311_update_preauth_hash(struct cifs_ses *ses,
struct kvec *iov, int nvec); struct kvec *iov, int nvec);
extern int smb2_query_info_compound(const unsigned int xid, extern int smb2_query_info_compound(const unsigned int xid,
struct cifs_tcon *tcon, struct cifs_tcon *tcon,
__le16 *utf16_path, u32 desired_access, const char *path, u32 desired_access,
u32 class, u32 type, u32 output_len, u32 class, u32 type, u32 output_len,
struct kvec *rsp, int *buftype, struct kvec *rsp, int *buftype,
struct cifs_sb_info *cifs_sb); struct cifs_sb_info *cifs_sb);
......
...@@ -656,8 +656,8 @@ static void __smb2_oplock_break_noti(struct work_struct *wk) ...@@ -656,8 +656,8 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)
rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE; rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE;
rsp->Reserved = 0; rsp->Reserved = 0;
rsp->Reserved2 = 0; rsp->Reserved2 = 0;
rsp->PersistentFid = cpu_to_le64(fp->persistent_id); rsp->PersistentFid = fp->persistent_id;
rsp->VolatileFid = cpu_to_le64(fp->volatile_id); rsp->VolatileFid = fp->volatile_id;
inc_rfc1001_len(work->response_buf, 24); inc_rfc1001_len(work->response_buf, 24);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment