From: Yihao Wu <wuyihao@linux.alibaba.com>
To: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>,
"J. Bruce Fields" <bfields@fieldses.org>
Cc: stable@vger.kernel.org, Joseph Qi <joseph.qi@linux.alibaba.com>,
caspar@linux.alibaba.com
Subject: [PATCH 2/2] NFSv4.1: Fix bug only the first CB_NOTIFY_LOCK is handled
Date: Wed, 8 May 2019 17:15:03 +0800 [thread overview]
Message-ID: <cdba66b5-29a3-e37b-1e0f-808c171d09c3@linux.alibaba.com> (raw)
In-Reply-To: <2a1cebca-1efb-1686-475b-a581e50e61b4@linux.alibaba.com>
When the first CB_NOTIFY_LOCK wakes a waiter, it can still fail to
acquire the lock. Then it might goes to sleep again. However it's removed
from the wait queue and not put back. So when the CB_NOTIFY_LOCK comes
again, it fails to wake this waiter.
Signed-off-by: Yihao Wu <wuyihao@linux.alibaba.com>
---
fs/nfs/nfs4proc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f13ea09..9de2c2d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6932,6 +6932,10 @@ struct nfs4_lock_waiter {
status = -ERESTARTSYS;
wait_woken(&wait, TASK_INTERRUPTIBLE, NFS4_LOCK_MAXTIMEOUT);
+ if (!signalled()) {
+ finish_wait(q, &wait);
+ add_wait_queue(q, &wait);
+ }
}
finish_wait(q, &wait);
--
1.8.3.1
next prev parent reply other threads:[~2019-05-08 9:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 9:11 [PATCH 0/2] Fix two bugs CB_NOTIFY_LOCK failing to wake a water Yihao Wu
2019-05-08 9:13 ` [PATCH 1/2] NFSv4.1: Again fix a race where CB_NOTIFY_LOCK fails to wake a waiter Yihao Wu
2019-05-08 9:15 ` Yihao Wu [this message]
2019-05-08 9:23 ` [PATCH 2/2] NFSv4.1: Fix bug only the first CB_NOTIFY_LOCK is handled Greg KH
2019-05-08 9:19 ` [PATCH 1/2] NFSv4.1: Again fix a race where CB_NOTIFY_LOCK fails to wake a waiter Greg KH
2019-05-08 9:39 ` Yihao Wu
2019-05-08 12:24 ` Jeff Layton
2019-05-08 18:18 ` Yihao Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cdba66b5-29a3-e37b-1e0f-808c171d09c3@linux.alibaba.com \
--to=wuyihao@linux.alibaba.com \
--cc=bfields@fieldses.org \
--cc=caspar@linux.alibaba.com \
--cc=jlayton@kernel.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).