Message ID | d45398aaaa1db68cd8bd7eac86acc4e04866f177.1743954240.git.trond.myklebust@hammerspace.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Two more places that need to handle ENETDOWN/ENETUNREACH | expand |
On Sun, 2025-04-06 at 17:45 +0200, trondmy@kernel.org wrote: > From: Trond Myklebust <trond.myklebust@hammerspace.com> > > 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 <trond.myklebust@hammerspace.com> > --- > fs/nfs/pnfs.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c > index 5f582713bf05..10fdd065a61c 100644 > --- a/fs/nfs/pnfs.c > +++ b/fs/nfs/pnfs.c > @@ -1661,6 +1661,18 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp, > /* Was there an RPC level error? If not, retry */ > if (task->tk_rpc_status == 0) > break; > + /* > + * Is there a fatal network level error? > + * If so release the layout, but flag the error. > + */ > + 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; Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 5f582713bf05..10fdd065a61c 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1661,6 +1661,18 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp, /* Was there an RPC level error? If not, retry */ if (task->tk_rpc_status == 0) break; + /* + * Is there a fatal network level error? + * If so release the layout, but flag the error. + */ + 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;