cifs: vary timeout on writes past EOF based on offset (try #5)
This is the fourth version of this patch: The first three generated a compiler warning asking for explicit curly braces. The first two didn't handle update the size correctly when writes that didn't start at the eof were done. The first patch also didn't update the size correctly when it explicitly set via truncate(). This patch adds code to track the client's current understanding of the size of the file on the server separate from the i_size, and then to use this info to semi-intelligently set the timeout for writes past the EOF. This helps prevent timeouts when trying to write large, sparse files on windows servers. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
committed by
Steve French
parent
d036f50fc2
commit
fbec9ab952
@ -1626,6 +1626,8 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
|
||||
int smb_hdr_len;
|
||||
int resp_buf_type = 0;
|
||||
|
||||
*nbytes = 0;
|
||||
|
||||
cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count));
|
||||
|
||||
if (tcon->ses->capabilities & CAP_LARGE_FILES) {
|
||||
@ -1682,11 +1684,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
|
||||
cifs_stats_inc(&tcon->num_writes);
|
||||
if (rc) {
|
||||
cFYI(1, ("Send error Write2 = %d", rc));
|
||||
*nbytes = 0;
|
||||
} else if (resp_buf_type == 0) {
|
||||
/* presumably this can not happen, but best to be safe */
|
||||
rc = -EIO;
|
||||
*nbytes = 0;
|
||||
} else {
|
||||
WRITE_RSP *pSMBr = (WRITE_RSP *)iov[0].iov_base;
|
||||
*nbytes = le16_to_cpu(pSMBr->CountHigh);
|
||||
|
Reference in New Issue
Block a user