From: Benny Halevy <benny@tonian.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, Benny Halevy <benny@tonian.com>
Subject: [PATCH] NFSv4.1: need to put_layout_hdr on _pnfs_return_layout error path
Date: Wed, 15 Jun 2011 11:39:57 -0400 [thread overview]
Message-ID: <1308152397-16920-1-git-send-email-benny@tonian.com> (raw)
We always get a reference on the layout header and we rely on
nfs4_layoutreturn_release to put it. If we hit an allocation error
before starting the rpc proc we bail out early without dereferncing
the layout header properly.
Signed-off-by: Benny Halevy <benny@tonian.com>
---
fs/nfs/nfs4proc.c | 1 +
fs/nfs/pnfs.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 79f3c33..a4705bc 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5774,6 +5774,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
dprintk("--> %s\n", __func__);
+ dprintk("%s: ref %d\n", atonic_read(&lo->plh_refcount));
if (!nfs4_sequence_done(task, &lrp->res.seq_res))
return;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 0feeccc..bc3eb74 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -675,6 +675,7 @@ _pnfs_return_layout(struct inode *ino)
lrp = kzalloc(sizeof(*lrp), GFP_KERNEL);
if (unlikely(lrp == NULL)) {
status = -ENOMEM;
+ put_layout_hdr(lo);
goto out;
}
--
1.7.4.4
next reply other threads:[~2011-06-15 15:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-15 15:39 Benny Halevy [this message]
2011-06-15 15:44 ` [PATCH] NFSv4.1: need to put_layout_hdr on _pnfs_return_layout error path Benny Halevy
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=1308152397-16920-1-git-send-email-benny@tonian.com \
--to=benny@tonian.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.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).