Two more places that need to handle ENETDOWN/ENETUNREACH
Subsystems (2)
[email protected]
maintainercover Two more places that need to handle ENETDOWN/ENETUNREACH
From: Trond Myklebust <[email protected]>
Omar Sandoval reports seeing layouts that are leaked when a container is shut down uncleanly.
Trond Myklebust (2):
NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
fs/nfs/nfs4proc.c | 9 +++++++++ fs/nfs/pnfs.c | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH 1/2 NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors
From: Trond Myklebust <[email protected]>
Ensure that the NFSv4 error handling code recognises the RPC_TASK_NETUNREACH_FATAL flag, and handles the ENETDOWN and ENETUNREACH errors accordingly.
--- fs/nfs/nfs4proc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/nfs/nfs4proc.c +9 -0
@@ -671,6 +671,15 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server,struct nfs_client *clp = server->nfs_client;int ret; +if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH ) && + task->tk_flags &RPC_TASK_NETUNREACH_FATAL ) { + exception->retry =0 ; + exception->recovering =0 ; + exception->retry =0 ; +return -EIO ; + } + ret =nfs4_do_handle_exception (server, errorcode, exception);if (exception->delay) {int ret2 =nfs4_exception_should_retrans (server, exception);
Signature · 1 line
2.49.0
Re: [PATCH 1/2] NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors
Quoted 16 lines · On Sun, 2025-04-06 at 11:11 +0200, [email protected] wrote:
From: Trond Myklebust <[email protected]>
Ensure that the NFSv4 error handling code recognises the
RPC_TASK_NETUNREACH_FATALflag, and handles the ENETDOWN and ENETUNREACH errors accordingly.Signed-off-by Trond Myklebust <[email protected]>--- fs/nfs/nfs4proc.c | 9 +++++++++ 1 file changed, 9 insertions(+)fs/nfs/nfs4proc.c +0
-0
fs/nfs/nfs4proc.c nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, · line 679
Quoted 9 lines
fs/nfs/nfs4proc.c +6
-0@@ -671,6 +671,15 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server,struct nfs_client *clp = server->nfs_client;int ret; +if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH ) && + task->tk_flags &RPC_TASK_NETUNREACH_FATAL ) { + exception->retry =0 ; + exception->recovering =0 ; + exception->retry =0 ;
Why set exception->retry twice?
fs/nfs/nfs4proc.c nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, · line 685
Quoted 6 lines
fs/nfs/nfs4proc.c +3
-0+return -EIO ; + } + ret =nfs4_do_handle_exception (server, errorcode, exception);if (exception->delay) {int ret2 =nfs4_exception_should_retrans (server, exception);
Other than that, this looks sane.
Trond Myklebust
maintainerRe: [PATCH 1/2] NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors
Quoted 22 lines · Jeff Layton
Quoted 21 lines · On Sun, 2025-04-06 at 11:11 +0200, [email protected] wrote:
From: Trond Myklebust <[email protected]>
Ensure that the NFSv4 error handling code recognises the
RPC_TASK_NETUNREACH_FATALflag, and handles the ENETDOWN and ENETUNREACH
errors accordingly.Signed-off-by Trond Myklebust <[email protected]>---
fs/nfs/nfs4proc.c | 9 +++++++++1 file changed, 9 insertions(+)fs/nfs/nfs4proc.c +0
-0@@ -671,6 +671,15 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, struct nfs_client *clp = server->nfs_client; int ret;
Quoted 8 lines
fs/nfs/nfs4proc.c nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, · line 679
Quoted 6 lines
fs/nfs/nfs4proc.c +6
-0+if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH) && + task->tk_flags & RPC_TASK_NETUNREACH_FATAL) { + exception->retry =0 ; + exception->recovering =0 ; + exception->retry =0 ;Why set
exception->retrytwice?
Oops. That last one is supposed to be exception->delay = 0
Thanks for noticing!
Quoted 13 lines
Quoted 9 lines
fs/nfs/nfs4proc.c +3
-0+return -EIO ; + } +ret =
nfs4_do_handle_exception(server, errorcode, exception);
if (exception->delay) {
int ret2 =nfs4_exception_should_retrans(server, exception);Other than that, this looks sane.
Reviewed-by Jeff Layton <[email protected]>
[email protected]
maintainerPATCH 2/2 NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
In reply to [email protected]From: Trond Myklebust <[email protected]>
If we have a fatal ENETDOWN or ENETUNREACH error, then the layoutreturn on close code should also handle that as fatal, and free the layouts.
--- fs/nfs/pnfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/nfs/pnfs.c +9 -1
@@ -1659,8 +1659,16 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,break ;case -NFS4ERR_NOMATCHING_LAYOUT :/* Was there an RPC level error? If not, retry */ -if (task->tk_rpc_status ==0 ) +if (task->tk_rpc_status ==0 ) { +if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH ) && + task->tk_flags &RPC_TASK_NETUNREACH_FATAL ) { + *ret =0 ; + (*respp)->lrs_present =0 ; + retval = -EIO ; + }break ; + }/* If the call was not sent, let caller handle it */ if (!RPC_WAS_SENT (task))return 0 ;
Signature · 1 line
2.49.0
Jeff Layton
maintainerRe: [PATCH 2/2] NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
Quoted 15 lines · On Sun, 2025-04-06 at 11:11 +0200, [email protected] wrote:
From: Trond Myklebust <[email protected]>
If we have a fatal ENETDOWN or ENETUNREACH error, then the layoutreturn on close code should also handle that as fatal, and free the layouts.
Signed-off-by Trond Myklebust <[email protected]>--- fs/nfs/pnfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)fs/nfs/pnfs.c +0
-0
fs/nfs/pnfs.c int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp, · line 1665
Quoted 8 lines
fs/nfs/pnfs.c +4
-1@@ -1659,8 +1659,16 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,break ;case -NFS4ERR_NOMATCHING_LAYOUT :/* Was there an RPC level error? If not, retry */ -if (task->tk_rpc_status ==0 ) +if (task->tk_rpc_status ==0 ) { +if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH ) && + task->tk_flags &RPC_TASK_NETUNREACH_FATAL ) {
You already checked that task->tk_rpc_status is 0, so the inside if statement will never be true. I think you probably want to get rid if the outside
if (task->tk_rpc_status == 0)
condition?
Quoted 9 lines
fs/nfs/pnfs.c +5
-0+ *ret =0 ; + (*respp)->lrs_present =0 ; + retval = -EIO ; + }break ; + }/* If the call was not sent, let caller handle it */ if (!RPC_WAS_SENT (task))return 0 ;
Signature · 1 line
Jeff Layton <[email protected]>
Trond Myklebust
maintainerRe: [PATCH 2/2] NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
Quoted 34 lines · Jeff Layton
Quoted 27 lines · On Sun, 2025-04-06 at 11:11 +0200, [email protected] wrote:
From: Trond Myklebust <[email protected]>
If we have a fatal ENETDOWN or ENETUNREACH error, then the layoutreturn
on close code should also handle that as fatal, and free the layouts.Signed-off-by Trond Myklebust <[email protected]>---
fs/nfs/pnfs.c | 10 +++++++++-1 file changed, 9 insertions(+), 1 deletion(-)fs/nfs/pnfs.c +0
-0@@ -1659,8 +1659,16 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp, break;case -NFS4ERR_NOMATCHING_LAYOUT:
/* Was there an RPC level error? If not, retry */fs/nfs/pnfs.c +3
-1-if (task->tk_rpc_status ==0 ) +if (task->tk_rpc_status ==0 ) { +if ((task->tk_rpc_status == -ENETDOWN || + task->tk_rpc_status == -ENETUNREACH)&&
fs/nfs/pnfs.c +1
-0+ task->tk_flags &Quoted 1 line
RPC_TASK_NETUNREACH_FATAL) {You already checked that
task->tk_rpc_statusis 0, so the inside if statement will never be true. I think you probably want to get rid if the outside
Quoted 3 lines
if (
task->tk_rpc_status== 0)condition?
Sorry... Jet lagged in Switzerland.
Let me move that out of the == 0 and before the !SENT...
Quoted 12 lines
Quoted 11 lines
fs/nfs/pnfs.c +4
-0+ *ret =0 ; + (*respp)->lrs_present =0 ; + retval = -EIO ; + }break;
fs/nfs/pnfs.c +1
-0+ }/* If the call was not sent, let caller handle it */
if (!RPC_WAS_SENT(task))
return 0;