From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@primarydata.com, Anna.Schumaker@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 10/10] nfs: ensure that the filehandle in CB_NOTIFY_LOCK request matches the inode
Date: Fri, 9 Sep 2016 14:48:20 -0400 [thread overview]
Message-ID: <1473446900-1897-1-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1473446870-1831-1-git-send-email-jlayton@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfs/callback_proc.c | 3 +--
fs/nfs/nfs4proc.c | 10 +++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 590ed26232cc..478636b59d32 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -642,8 +642,7 @@ __be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, void *dummy,
/* Don't wake anybody if the string looked bogus */
if (lowner->id || lowner->s_dev)
- __wake_up(&cps->clp->cl_lock_waitq, TASK_NORMAL, 0,
- &args->cbnl_owner);
+ __wake_up(&cps->clp->cl_lock_waitq, TASK_NORMAL, 0, args);
return htonl(NFS4_OK);
}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2271c44aff32..71325fc8c650 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6189,6 +6189,7 @@ nfs4_retry_setlk_simple(struct nfs4_state *state, int cmd,
#ifdef CONFIG_NFS_V4_1
struct nfs4_lock_waiter {
struct task_struct *task;
+ struct inode *inode;
struct nfs_lowner *owner;
bool notified;
};
@@ -6197,8 +6198,10 @@ static int
nfs4_wake_lock_waiter(wait_queue_t *wait, unsigned int mode, int flags, void *key)
{
int ret;
+ struct cb_notify_lock_args *cbnl = key;
struct nfs4_lock_waiter *waiter = wait->private;
- struct nfs_lowner *lowner = key, *wowner = waiter->owner;
+ struct nfs_lowner *lowner = &cbnl->cbnl_owner,
+ *wowner = waiter->owner;
/* Only wake if the callback was for the same owner */
if (lowner->clientid != wowner->clientid ||
@@ -6206,6 +6209,10 @@ nfs4_wake_lock_waiter(wait_queue_t *wait, unsigned int mode, int flags, void *ke
lowner->s_dev != wowner->s_dev)
return 0;
+ /* Make sure it's for the right inode */
+ if (nfs_compare_fh(NFS_FH(waiter->inode), &cbnl->cbnl_fh))
+ return 0;
+
waiter->notified = true;
/* override "private" so we can use default_wake_function */
@@ -6228,6 +6235,7 @@ nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
.id = lsp->ls_seqid.owner_id,
.s_dev = server->s_dev };
struct nfs4_lock_waiter waiter = { .task = current,
+ .inode = state->inode,
.owner = &owner,
.notified = false };
wait_queue_t wait;
--
2.7.4
prev parent reply other threads:[~2016-09-09 18:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 18:47 [PATCH v2 00/10] nfs: add CB_NOTIFY_LOCK support to nfs client Jeff Layton
2016-09-09 18:47 ` [PATCH v2 01/10] nfs: the length argument to read_buf should be unsigned Jeff Layton
2016-09-09 18:47 ` [PATCH v2 02/10] nfs: eliminate pointless and confusing do_vfs_lock wrappers Jeff Layton
2016-09-09 18:47 ` [PATCH v2 03/10] nfs: check for POSIX lock capability on server even for flock locks Jeff Layton
2016-09-09 18:47 ` [PATCH v2 04/10] nfs: use safe, interruptible sleeps when waiting to retry LOCK Jeff Layton
2016-09-09 18:47 ` [PATCH v2 05/10] nfs: track whether server sets MAY_NOTIFY_LOCK flag Jeff Layton
2016-09-12 20:19 ` Anna Schumaker
2016-09-12 20:30 ` Jeff Layton
2016-09-12 20:38 ` Anna Schumaker
2016-09-09 18:47 ` [PATCH v2 06/10] nfs: add handling for CB_NOTIFY_LOCK in client Jeff Layton
2016-09-09 18:47 ` [PATCH v2 07/10] nfs: move nfs4_set_lock_state call into caller Jeff Layton
2016-09-09 18:47 ` [PATCH v2 08/10] nfs: move nfs4 lock retry attempt loop to a separate function Jeff Layton
2016-09-09 18:47 ` [PATCH v2 09/10] nfs: add code to allow client to wait on lock callbacks Jeff Layton
2016-09-09 18:48 ` Jeff Layton [this message]
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=1473446900-1897-1-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=Anna.Schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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).