diff mbox series

[7/7] cifs: set replay flag for retries of write command

Message ID 20240121033248.125282-7-sprasad@microsoft.com (mailing list archive)
State New, archived
Headers show
Series [1/7] cifs: handle servers that still advertise multichannel after disabling | expand

Commit Message

Shyam Prasad N Jan. 21, 2024, 3:32 a.m. UTC
From: Shyam Prasad N <sprasad@microsoft.com>

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>
---
 fs/smb/client/cifsglob.h | 1 +
 fs/smb/client/file.c     | 1 +
 fs/smb/client/smb2pdu.c  | 4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

Comments

Steve French Jan. 21, 2024, 4:02 a.m. UTC | #1
tentatively merged to cifs-2.6.git for-next pending review and testing
(after correcting the duplicate label problem with patch 1)

On Sat, Jan 20, 2024 at 9:33 PM <nspmangalore@gmail.com> wrote:
>
> From: Shyam Prasad N <sprasad@microsoft.com>
>
> 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>
> ---
>  fs/smb/client/cifsglob.h | 1 +
>  fs/smb/client/file.c     | 1 +
>  fs/smb/client/smb2pdu.c  | 4 +++-
>  3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
> index b5abe4d6f478..acda357e1dfd 100644
> --- a/fs/smb/client/cifsglob.h
> +++ b/fs/smb/client/cifsglob.h
> @@ -1506,6 +1506,7 @@ struct cifs_writedata {
>         struct smbd_mr                  *mr;
>  #endif
>         struct cifs_credits             credits;
> +       bool                            replay;
>  };
>
>  /*
> diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
> index 1b4262aff8fa..49d262d1df5f 100644
> --- a/fs/smb/client/file.c
> +++ b/fs/smb/client/file.c
> @@ -3300,6 +3300,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;
> diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
> index 0291482a3f51..a8ac9240a854 100644
> --- a/fs/smb/client/smb2pdu.c
> +++ b/fs/smb/client/smb2pdu.c
> @@ -4770,7 +4770,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);
>
>         /*
> @@ -4855,6 +4855,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);
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index b5abe4d6f478..acda357e1dfd 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1506,6 +1506,7 @@  struct cifs_writedata {
 	struct smbd_mr			*mr;
 #endif
 	struct cifs_credits		credits;
+	bool				replay;
 };
 
 /*
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 1b4262aff8fa..49d262d1df5f 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3300,6 +3300,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;
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 0291482a3f51..a8ac9240a854 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -4770,7 +4770,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);
 
 	/*
@@ -4855,6 +4855,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);