* [PATCH AUTOSEL 6.1 007/212] NFSv4: Check for delegation validity in nfs_start_delegation_return_locked()
[not found] <20250505230624.2692522-1-sashal@kernel.org>
@ 2025-05-05 23:02 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 008/212] NFS: Don't allow waiting for exiting tasks Sasha Levin
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:02 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Sasha Levin, trondmy, anna, linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit 9e8f324bd44c1fe026b582b75213de4eccfa1163 ]
Check that the delegation is still attached after taking the spin lock
in nfs_start_delegation_return_locked().
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/delegation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 6363bbc37f425..17b38da17288b 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -297,7 +297,8 @@ nfs_start_delegation_return_locked(struct nfs_inode *nfsi)
if (delegation == NULL)
goto out;
spin_lock(&delegation->lock);
- if (!test_and_set_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) {
+ if (delegation->inode &&
+ !test_and_set_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) {
clear_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags);
/* Refcount matched in nfs_end_delegation_return() */
ret = nfs_get_delegation(delegation);
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 008/212] NFS: Don't allow waiting for exiting tasks
[not found] <20250505230624.2692522-1-sashal@kernel.org>
2025-05-05 23:02 ` [PATCH AUTOSEL 6.1 007/212] NFSv4: Check for delegation validity in nfs_start_delegation_return_locked() Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 009/212] SUNRPC: " Sasha Levin
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Sasha Levin, trondmy, anna,
linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit 8d3ca331026a7f9700d3747eed59a67b8f828cdc ]
Once a task calls exit_signals() it can no longer be signalled. So do
not allow it to do killable waits.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/inode.c | 2 ++
fs/nfs/internal.h | 5 +++++
fs/nfs/nfs3proc.c | 2 +-
fs/nfs/nfs4proc.c | 9 +++++++--
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 964df0725f4c2..f2e66b946f4b4 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -74,6 +74,8 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
{
+ if (unlikely(nfs_current_task_exiting()))
+ return -EINTR;
schedule();
if (signal_pending_state(mode, current))
return -ERESTARTSYS;
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index ece517ebcca0b..84361674bffc7 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -832,6 +832,11 @@ static inline u32 nfs_stateid_hash(const nfs4_stateid *stateid)
NFS4_STATEID_OTHER_SIZE);
}
+static inline bool nfs_current_task_exiting(void)
+{
+ return (current->flags & PF_EXITING) != 0;
+}
+
static inline bool nfs_error_is_fatal(int err)
{
switch (err) {
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 2e7579626cf01..f036d30f7515c 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -39,7 +39,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
__set_current_state(TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
res = -ERESTARTSYS;
- } while (!fatal_signal_pending(current));
+ } while (!fatal_signal_pending(current) && !nfs_current_task_exiting());
return res;
}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5b06b8d4e0147..57c19a7d9c3e1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -422,6 +422,8 @@ static int nfs4_delay_killable(long *timeout)
{
might_sleep();
+ if (unlikely(nfs_current_task_exiting()))
+ return -EINTR;
__set_current_state(TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
schedule_timeout(nfs4_update_delay(timeout));
if (!__fatal_signal_pending(current))
@@ -433,6 +435,8 @@ static int nfs4_delay_interruptible(long *timeout)
{
might_sleep();
+ if (unlikely(nfs_current_task_exiting()))
+ return -EINTR;
__set_current_state(TASK_INTERRUPTIBLE|TASK_FREEZABLE_UNSAFE);
schedule_timeout(nfs4_update_delay(timeout));
if (!signal_pending(current))
@@ -1712,7 +1716,8 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,
rcu_read_unlock();
trace_nfs4_open_stateid_update_wait(state->inode, stateid, 0);
- if (!fatal_signal_pending(current)) {
+ if (!fatal_signal_pending(current) &&
+ !nfs_current_task_exiting()) {
if (schedule_timeout(5*HZ) == 0)
status = -EAGAIN;
else
@@ -3500,7 +3505,7 @@ static bool nfs4_refresh_open_old_stateid(nfs4_stateid *dst,
write_sequnlock(&state->seqlock);
trace_nfs4_close_stateid_update_wait(state->inode, dst, 0);
- if (fatal_signal_pending(current))
+ if (fatal_signal_pending(current) || nfs_current_task_exiting())
status = -EINTR;
else
if (schedule_timeout(5*HZ) != 0)
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 009/212] SUNRPC: Don't allow waiting for exiting tasks
[not found] <20250505230624.2692522-1-sashal@kernel.org>
2025-05-05 23:02 ` [PATCH AUTOSEL 6.1 007/212] NFSv4: Check for delegation validity in nfs_start_delegation_return_locked() Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 008/212] NFS: Don't allow waiting for exiting tasks Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 017/212] NFSv4: Treat ENETUNREACH errors as fatal for state recovery Sasha Levin
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Sasha Levin, chuck.lever, trondmy,
anna, davem, edumazet, kuba, pabeni, linux-nfs, netdev
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit 14e41b16e8cb677bb440dca2edba8b041646c742 ]
Once a task calls exit_signals() it can no longer be signalled. So do
not allow it to do killable waits.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/sched.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 9b45fbdc90cab..73bc39281ef5f 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -276,6 +276,8 @@ EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue);
static int rpc_wait_bit_killable(struct wait_bit_key *key, int mode)
{
+ if (unlikely(current->flags & PF_EXITING))
+ return -EINTR;
schedule();
if (signal_pending_state(mode, current))
return -ERESTARTSYS;
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 017/212] NFSv4: Treat ENETUNREACH errors as fatal for state recovery
[not found] <20250505230624.2692522-1-sashal@kernel.org>
` (2 preceding siblings ...)
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 009/212] SUNRPC: " Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 018/212] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting Sasha Levin
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Benjamin Coddington, Sasha Levin,
trondmy, anna, linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit 0af5fb5ed3d2fd9e110c6112271f022b744a849a ]
If a containerised process is killed and causes an ENETUNREACH or
ENETDOWN error to be propagated to the state manager, then mark the
nfs_client as being dead so that we don't loop in functions that are
expecting recovery to succeed.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4state.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 48ea406604229..80a7c5bd7a476 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -2737,7 +2737,15 @@ static void nfs4_state_manager(struct nfs_client *clp)
pr_warn_ratelimited("NFS: state manager%s%s failed on NFSv4 server %s"
" with error %d\n", section_sep, section,
clp->cl_hostname, -status);
- ssleep(1);
+ switch (status) {
+ case -ENETDOWN:
+ case -ENETUNREACH:
+ nfs_mark_client_ready(clp, -EIO);
+ break;
+ default:
+ ssleep(1);
+ break;
+ }
out_drain:
memalloc_nofs_restore(memflags);
nfs4_end_drain_session(clp);
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 018/212] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting
[not found] <20250505230624.2692522-1-sashal@kernel.org>
` (3 preceding siblings ...)
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 017/212] NFSv4: Treat ENETUNREACH errors as fatal for state recovery Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 019/212] SUNRPC: rpcbind should never reset the port to the value '0' Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 027/212] pNFS/flexfiles: Report ENETDOWN as a connection error Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Benjamin Coddington, Sasha Levin,
chuck.lever, trondmy, anna, davem, edumazet, kuba, pabeni,
linux-nfs, netdev
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit bf9be373b830a3e48117da5d89bb6145a575f880 ]
The autobind setting was supposed to be determined in rpc_create(),
since commit c2866763b402 ("SUNRPC: use sockaddr + size when creating
remote transport endpoints").
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index b6529a9d37d37..a390a4e5592f2 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -275,9 +275,6 @@ static struct rpc_xprt *rpc_clnt_set_transport(struct rpc_clnt *clnt,
old = rcu_dereference_protected(clnt->cl_xprt,
lockdep_is_held(&clnt->cl_lock));
- if (!xprt_bound(xprt))
- clnt->cl_autobind = 1;
-
clnt->cl_timeout = timeout;
rcu_assign_pointer(clnt->cl_xprt, xprt);
spin_unlock(&clnt->cl_lock);
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 019/212] SUNRPC: rpcbind should never reset the port to the value '0'
[not found] <20250505230624.2692522-1-sashal@kernel.org>
` (4 preceding siblings ...)
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 018/212] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 027/212] pNFS/flexfiles: Report ENETDOWN as a connection error Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Benjamin Coddington, Sasha Levin,
chuck.lever, trondmy, anna, davem, edumazet, kuba, pabeni,
linux-nfs, netdev
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit 214c13e380ad7636631279f426387f9c4e3c14d9 ]
If we already had a valid port number for the RPC service, then we
should not allow the rpcbind client to set it to the invalid value '0'.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/rpcb_clnt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 82afb56695f8d..1ec20163a0b7d 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -797,9 +797,10 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
}
trace_rpcb_setport(child, map->r_status, map->r_port);
- xprt->ops->set_port(xprt, map->r_port);
- if (map->r_port)
+ if (map->r_port) {
+ xprt->ops->set_port(xprt, map->r_port);
xprt_set_bound(xprt);
+ }
}
/*
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 6.1 027/212] pNFS/flexfiles: Report ENETDOWN as a connection error
[not found] <20250505230624.2692522-1-sashal@kernel.org>
` (5 preceding siblings ...)
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 019/212] SUNRPC: rpcbind should never reset the port to the value '0' Sasha Levin
@ 2025-05-05 23:03 ` Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-05-05 23:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Trond Myklebust, Jeff Layton, Chuck Lever, Sasha Levin, trondmy,
anna, snitzer, neilb, kolga, linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
[ Upstream commit aa42add73ce9b9e3714723d385c254b75814e335 ]
If the client should see an ENETDOWN when trying to connect to the data
server, it might still be able to talk to the metadata server through
another NIC. If so, report the error.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 8056b05bd8dca..07e5ea64dcd68 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1255,6 +1255,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
case -ECONNRESET:
case -EHOSTDOWN:
case -EHOSTUNREACH:
+ case -ENETDOWN:
case -ENETUNREACH:
case -EADDRINUSE:
case -ENOBUFS:
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-05-05 23:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250505230624.2692522-1-sashal@kernel.org>
2025-05-05 23:02 ` [PATCH AUTOSEL 6.1 007/212] NFSv4: Check for delegation validity in nfs_start_delegation_return_locked() Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 008/212] NFS: Don't allow waiting for exiting tasks Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 009/212] SUNRPC: " Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 017/212] NFSv4: Treat ENETUNREACH errors as fatal for state recovery Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 018/212] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 019/212] SUNRPC: rpcbind should never reset the port to the value '0' Sasha Levin
2025-05-05 23:03 ` [PATCH AUTOSEL 6.1 027/212] pNFS/flexfiles: Report ENETDOWN as a connection error Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox