nfs: Don't busy-wait on SIGKILL in __nfs_iocounter_wait
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 nfs: Don't busy-wait on SIGKILL in __nfs_iocounter_wait
If a SIGKILL is sent to a task waiting in __nfs_iocounter_wait, it will busy-wait or soft lockup in its while loop. nfs_wait_bit_killable won't sleep, and the loop won't exit on the error return.
Stop the busy-wait by breaking out of the loop when nfs_wait_bit_killable returns an error.
---
I'm not completely confident this is the right solution. I would like feedback if the intention was to break out of this loop on error, or if we do need to wait here until io_count hits zero and use something other than nfs_wait_bit_killable to wait in case of SIGKILL.
pagelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pagelist.c +1 -1
@@ -116,7 +116,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c)if (atomic_read (&c->io_count) ==0 )break ; ret =nfs_wait_bit_killable (&c->flags); - }while (atomic_read (&c->io_count) !=0 ); + }while (atomic_read (&c->io_count) !=0 && !ret);finish_wait (wq, &q.wait);return ret; }
Trond Myklebust
AppliedQuoted 24 lines · David Jeffery
If a SIGKILL is sent to a task waiting in
__nfs_iocounter_wait, it will busy-wait or soft lockup in its while loop.nfs_wait_bit_killablewon't sleep, and the loop won't exit on the error return.Stop the busy-wait by breaking out of the loop when
nfs_wait_bit_killablereturns an error.Signed-off-by David Jeffery <[email protected]>---
I'm not completely confident this is the right solution. I would like feedback if the intention was to break out of this loop on error, or if we do need to wait here untilio_counthits zero and use something other thannfs_wait_bit_killableto wait in case of SIGKILL.pagelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfs/pagelist.c +0
-0
fs/nfs/pagelist.c __nfs_iocounter_wait(struct nfs_io_counter *c) · line 122
Quoted 8 lines
fs/nfs/pagelist.c +1
-1@@ -116,7 +116,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c)if (atomic_read (&c->io_count) ==0 )break ; ret =nfs_wait_bit_killable (&c->flags); - }while (atomic_read (&c->io_count) !=0 ); + }while (atomic_read (&c->io_count) !=0 && !ret);finish_wait (wq, &q.wait);return ret; }
Applied.
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]