Bug#769935: linux: Please backport nfs: Don't busy-wait on SIGKILL in __nfs_iocounter_wait
Source: linux
Version: 3.16.7-2
Severity: important
Tags: upstream patch
Dear Maintainer,
in certain circumstances, the kernel may busy-wait indefinitely after
processing a SIGKILL to a process when using NFS. There is a patch for
this
issue that went into 3.17:
<http://www.spinics.net/lists/linux-nfs/msg45807.html>
<https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=92a56555bd576c61b27a5cab9f38a33a1e9a1df5>
I've attached a backported version of the patch for this (the original
patch
does not directly apply due to another commit [1] in 3.17).
I've tested that the patch applies (against 3.16.7-2), the modified
package compiles and that the resulting kernel boots (with no obvious
regressions). I haven't seen any busy-waits with that since, but the
bug is not trivial to trigger.
Thanks!
Christian
[1]
<https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c1221321b7c25b53204447cff9949a6d5a7ddddc>
From 92a56555bd576c61b27a5cab9f38a33a1e9a1df5 Mon Sep 17 00:00:00 2001
From: David Jeffery <djeffery@redhat.com>
Date: Tue, 5 Aug 2014 11:19:42 -0400
Subject: 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.
Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 932c6cc..be7cbce 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -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;
}
--
cgit v0.10.1
Reply to: