Linux-NFS Archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS: Fix READ_PLUS when server doesn't support OP_READ_PLUS
@ 2024-04-25 20:24 Anna Schumaker
  2024-04-26 11:43 ` Benjamin Coddington
  0 siblings, 1 reply; 2+ messages in thread
From: Anna Schumaker @ 2024-04-25 20:24 UTC (permalink / raw
  To: linux-nfs, trond.myklebust; +Cc: anna

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

Olga showed me a case where the client was sending multiple READ_PLUS
calls to the server in parallel, and the server replied
NFS4ERR_OPNOTSUPP to each. The client would fall back to READ for the
first reply, but fail to retry the other calls.

I fix this by removing the test for NFS_CAP_READ_PLUS in
nfs4_read_plus_not_supported(). This allows us to reschedule any
READ_PLUS call that has a NFS4ERR_OPNOTSUPP return value, even after the
capability has been cleared.

Reported-by: Olga Kornievskaia <kolga@netapp.com>
Fixes: c567552612ec ("NFS: Add READ_PLUS data segment support")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ea390db94b62..c93c12063b3a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5456,7 +5456,7 @@ static bool nfs4_read_plus_not_supported(struct rpc_task *task,
 	struct rpc_message *msg = &task->tk_msg;
 
 	if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_READ_PLUS] &&
-	    server->caps & NFS_CAP_READ_PLUS && task->tk_status == -ENOTSUPP) {
+	    task->tk_status == -ENOTSUPP) {
 		server->caps &= ~NFS_CAP_READ_PLUS;
 		msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
 		rpc_restart_call_prepare(task);
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFS: Fix READ_PLUS when server doesn't support OP_READ_PLUS
  2024-04-25 20:24 [PATCH] NFS: Fix READ_PLUS when server doesn't support OP_READ_PLUS Anna Schumaker
@ 2024-04-26 11:43 ` Benjamin Coddington
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Coddington @ 2024-04-26 11:43 UTC (permalink / raw
  To: Anna Schumaker; +Cc: linux-nfs, trond.myklebust

On 25 Apr 2024, at 16:24, Anna Schumaker wrote:

> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
>
> Olga showed me a case where the client was sending multiple READ_PLUS
> calls to the server in parallel, and the server replied
> NFS4ERR_OPNOTSUPP to each. The client would fall back to READ for the
> first reply, but fail to retry the other calls.
>
> I fix this by removing the test for NFS_CAP_READ_PLUS in
> nfs4_read_plus_not_supported(). This allows us to reschedule any
> READ_PLUS call that has a NFS4ERR_OPNOTSUPP return value, even after the
> capability has been cleared.
>
> Reported-by: Olga Kornievskaia <kolga@netapp.com>
> Fixes: c567552612ec ("NFS: Add READ_PLUS data segment support")
> Cc: stable@vger.kernel.org # v5.10+
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Ben

> ---
>  fs/nfs/nfs4proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index ea390db94b62..c93c12063b3a 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5456,7 +5456,7 @@ static bool nfs4_read_plus_not_supported(struct rpc_task *task,
>  	struct rpc_message *msg = &task->tk_msg;
>
>  	if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_READ_PLUS] &&
> -	    server->caps & NFS_CAP_READ_PLUS && task->tk_status == -ENOTSUPP) {
> +	    task->tk_status == -ENOTSUPP) {
>  		server->caps &= ~NFS_CAP_READ_PLUS;
>  		msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
>  		rpc_restart_call_prepare(task);
> -- 
> 2.44.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-26 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 20:24 [PATCH] NFS: Fix READ_PLUS when server doesn't support OP_READ_PLUS Anna Schumaker
2024-04-26 11:43 ` Benjamin Coddington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).