cifs: set replay flag for retries of write command
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 18 Jan 2024 09:14:10 +0000 (09:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2024 14:22:46 +0000 (16:22 +0200)
[ Upstream commit 4cdad80261862c8cdcbb5fd232aa713d0bdefe24 ]

Similar to the rest of the commands, this is a change
to add replay flags on retry. This one does not add a
back-off, considering that we may want to flush a write
ASAP to the server. Considering that this will be a
flush of cached pages, the retrans value is also not
honoured.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/cifsglob.h
fs/smb/client/file.c
fs/smb/client/smb2pdu.c

index 479bf0d9ad589e6393930e20a69dfaa372646f81..8fbdb781d70a6734e6ffbe074f202213856d4f54 100644 (file)
@@ -1515,6 +1515,7 @@ struct cifs_writedata {
        struct smbd_mr                  *mr;
 #endif
        struct cifs_credits             credits;
+       bool                            replay;
 };
 
 /*
index f41804245fca1d51198d515ec8686e81e7529245..6d44991e1ccdcd002aff22b5fa9a12b10639e3d0 100644 (file)
@@ -3413,6 +3413,7 @@ cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
                        if (wdata->cfile->invalidHandle)
                                rc = -EAGAIN;
                        else {
+                               wdata->replay = true;
 #ifdef CONFIG_CIFS_SMB_DIRECT
                                if (wdata->mr) {
                                        wdata->mr->need_invalidate = true;
index 6a5d478b3cef6b5a6de6c87cf1c975c9ca6c1461..c73a621a8b83ebc4eaf22df42a089c331303540e 100644 (file)
@@ -4801,7 +4801,7 @@ smb2_async_writev(struct cifs_writedata *wdata,
        struct cifs_io_parms *io_parms = NULL;
        int credit_request;
 
-       if (!wdata->server)
+       if (!wdata->server || wdata->replay)
                server = wdata->server = cifs_pick_channel(tcon->ses);
 
        /*
@@ -4886,6 +4886,8 @@ smb2_async_writev(struct cifs_writedata *wdata,
        rqst.rq_nvec = 1;
        rqst.rq_iter = wdata->iter;
        rqst.rq_iter_size = iov_iter_count(&rqst.rq_iter);
+       if (wdata->replay)
+               smb2_set_replay(server, &rqst);
 #ifdef CONFIG_CIFS_SMB_DIRECT
        if (wdata->mr)
                iov[0].iov_len += sizeof(struct smbd_buffer_descriptor_v1);