cifs: do not send close in compound create+close requests
commit 04ad69c342fc4de5bd23be9ef15ea7574fb1a87e upstream. In case of interrupted syscalls, prevent sending CLOSE commands for compound CREATE+CLOSE requests by introducing an CIFS_CP_CREATE_CLOSE_OP flag to indicate lower layers that it should not send a CLOSE command to the MIDs corresponding the compound CREATE+CLOSE request. A simple reproducer: #!/bin/bash mount //server/share /mnt -o username=foo,password=*** tc qdisc add dev eth0 root netem delay 450ms stat -f /mnt &>/dev/null & pid=$! sleep 0.01 kill $pid tc qdisc del dev eth0 root umount /mnt Before patch: ... 6 0.256893470 192.168.122.2 → 192.168.122.15 SMB2 402 Create Request File: ;GetInfo Request FS_INFO/FileFsFullSizeInformation;Close Request 7 0.257144491 192.168.122.15 → 192.168.122.2 SMB2 498 Create Response File: ;GetInfo Response;Close Response 9 0.260798209 192.168.122.2 → 192.168.122.15 SMB2 146 Close Request File: 10 0.260841089 192.168.122.15 → 192.168.122.2 SMB2 130 Close Response, Error: STATUS_FILE_CLOSED Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Aurelien Aptel <aaptel@suse.com> CC: <stable@vger.kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
310a1ffe7b
commit
d308202c1b
@@ -1137,7 +1137,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
struct TCP_Server_Info *server = cifs_pick_channel(ses);
|
||||
__le16 *utf16_path = NULL;
|
||||
int ea_name_len = strlen(ea_name);
|
||||
int flags = 0;
|
||||
int flags = CIFS_CP_CREATE_CLOSE_OP;
|
||||
int len;
|
||||
struct smb_rqst rqst[3];
|
||||
int resp_buftype[3];
|
||||
@@ -1515,7 +1515,7 @@ smb2_ioctl_query_info(const unsigned int xid,
|
||||
struct smb_query_info qi;
|
||||
struct smb_query_info __user *pqi;
|
||||
int rc = 0;
|
||||
int flags = 0;
|
||||
int flags = CIFS_CP_CREATE_CLOSE_OP;
|
||||
struct smb2_query_info_rsp *qi_rsp = NULL;
|
||||
struct smb2_ioctl_rsp *io_rsp = NULL;
|
||||
void *buffer = NULL;
|
||||
@@ -2482,7 +2482,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
{
|
||||
struct cifs_ses *ses = tcon->ses;
|
||||
struct TCP_Server_Info *server = cifs_pick_channel(ses);
|
||||
int flags = 0;
|
||||
int flags = CIFS_CP_CREATE_CLOSE_OP;
|
||||
struct smb_rqst rqst[3];
|
||||
int resp_buftype[3];
|
||||
struct kvec rsp_iov[3];
|
||||
@@ -2880,7 +2880,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
unsigned int sub_offset;
|
||||
unsigned int print_len;
|
||||
unsigned int print_offset;
|
||||
int flags = 0;
|
||||
int flags = CIFS_CP_CREATE_CLOSE_OP;
|
||||
struct smb_rqst rqst[3];
|
||||
int resp_buftype[3];
|
||||
struct kvec rsp_iov[3];
|
||||
@@ -3062,7 +3062,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
struct cifs_open_parms oparms;
|
||||
struct cifs_fid fid;
|
||||
struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
|
||||
int flags = 0;
|
||||
int flags = CIFS_CP_CREATE_CLOSE_OP;
|
||||
struct smb_rqst rqst[3];
|
||||
int resp_buftype[3];
|
||||
struct kvec rsp_iov[3];
|
||||
|
Reference in New Issue
Block a user