diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 15:41:05 -0700 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 15:41:05 -0700 |
commit | 251ec410c495cb93c7ae2cb4beda29205d9bd35f (patch) | |
tree | d9f971d9ca4f00ed19a6edb1ea9cd563c51ffe65 | |
parent | ae2bb03236fc978bdf673c19d39832500793b83c (diff) | |
download | kernel-common-251ec410c495cb93c7ae2cb4beda29205d9bd35f.tar.gz kernel-common-251ec410c495cb93c7ae2cb4beda29205d9bd35f.tar.bz2 kernel-common-251ec410c495cb93c7ae2cb4beda29205d9bd35f.zip |
NFSv4.1: Fix another refcount issue in pnfs_find_alloc_layout
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/pnfs.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index d737557747b9..fe9968a62cad 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -907,18 +907,19 @@ pnfs_find_alloc_layout(struct inode *ino, dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout); - if (nfsi->layout) { - pnfs_get_layout_hdr(nfsi->layout); - return nfsi->layout; - } + if (nfsi->layout != NULL) + goto out_existing; spin_unlock(&ino->i_lock); new = alloc_init_layout_hdr(ino, ctx, gfp_flags); spin_lock(&ino->i_lock); - if (likely(nfsi->layout == NULL)) /* Won the race? */ + if (likely(nfsi->layout == NULL)) { /* Won the race? */ nfsi->layout = new; - else - pnfs_free_layout_hdr(new); + return new; + } + pnfs_free_layout_hdr(new); +out_existing: + pnfs_get_layout_hdr(nfsi->layout); return nfsi->layout; } |