From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 6/6] pnfs_submit: fix layoutreturn layout stateid processing
Date: Thu, 28 Oct 2010 15:10:01 -0400 [thread overview]
Message-ID: <1288293001-26289-6-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1288293001-26289-1-git-send-email-iisaman@netapp.com>
From: Andy Adamson <andros@netapp.com>
This is a rebase of Andy's patch (which is not yet in the pns-submit tree)
onto my patches, yet taking into account some issues Benny noted which are
best addressed by ensuring that nfs4_layoutreturn_release make no reference
to call results, as there is no guarantee that a call was made.
Add missing layoutreturn stateid update.
This patch also enforces the following rfc 5661 requirement:
section 12.5.3
"For LAYOUTRETURN results, the client MUST delete the range from its
record of what ranges of the file's layout it had before using the
seqid."
Reported-by: P.B.Shelley <shelleypt@gmail.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
fs/nfs/nfs4proc.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 96bd822..4fba3f0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5674,10 +5674,6 @@ static void nfs4_layoutreturn_release(void *calldata)
if (lrp->args.return_type == RETURN_FILE) {
struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
- spin_lock(&lo->inode->i_lock);
- if (!lrp->res.lrs_present)
- pnfs_invalidate_layout_stateid(lo);
- spin_unlock(&lo->inode->i_lock);
pnfs_layoutreturn_release(lo, &lrp->args.range);
}
kfree(calldata);
@@ -5720,6 +5716,16 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync)
if (status != 0)
goto out;
status = task->tk_status;
+ if (status == 0 && lrp->args.return_type == RETURN_FILE) {
+ struct pnfs_layout_hdr *lo = NFS_I(ino)->layout;
+
+ spin_lock(&lo->inode->i_lock);
+ if (!lrp->res.lrs_present)
+ pnfs_invalidate_layout_stateid(lo);
+ else
+ pnfs_set_layout_stateid(lo, &lrp->res.stateid);
+ spin_unlock(&lo->inode->i_lock);
+ }
out:
dprintk("<-- %s\n", __func__);
rpc_put_task(task);
--
1.7.2.1
next prev parent reply other threads:[~2010-10-28 19:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 19:09 [PATCH 1/6] NFSv4.1: Callback share session between ops Fred Isaman
2010-10-28 19:09 ` [PATCH 2/6] pnfs-submit: change pnfs_layout_segment refcounting from kref to atomic_t Fred Isaman
2010-10-28 19:09 ` [PATCH 3/6] pnfs-submit: remove _pnfs_can_return_lseg call from pnfs_clear_lseg_list Fred Isaman
2010-10-28 19:09 ` [PATCH 4/6] pnfs-submit: change layout state seqlock to a spinlock Fred Isaman
2010-10-28 19:10 ` [PATCH 5/6] pnfs-submit: nfs4_layoutreturn_release would crash on a bulk return Fred Isaman
2010-10-28 19:10 ` Fred Isaman [this message]
2010-10-28 19:35 ` [PATCH 1/6] NFSv4.1: Callback share session between ops Trond Myklebust
2010-10-28 20:18 ` Andy Adamson
2010-10-28 21:31 ` Trond Myklebust
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=1288293001-26289-6-git-send-email-iisaman@netapp.com \
--to=iisaman@netapp.com \
--cc=linux-nfs@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).