mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
NFS: Don't allow waiting for exiting tasks
[ Upstream commit 8d3ca33102
]
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>
This commit is contained in:
parent
46a47dc10f
commit
ac83bf58f6
|
@ -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;
|
||||
|
|
|
@ -901,6 +901,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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -434,6 +434,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))
|
||||
|
@ -445,6 +447,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))
|
||||
|
@ -1765,7 +1769,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
|
||||
|
@ -3569,7 +3574,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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user