mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 01:24:33 +00:00
NFSv4.1: Fix another refcount issue in pnfs_find_alloc_layout
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
ae2bb03236
commit
251ec410c4
@ -907,18 +907,19 @@ pnfs_find_alloc_layout(struct inode *ino,
|
|||||||
|
|
||||||
dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout);
|
dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout);
|
||||||
|
|
||||||
if (nfsi->layout) {
|
if (nfsi->layout != NULL)
|
||||||
pnfs_get_layout_hdr(nfsi->layout);
|
goto out_existing;
|
||||||
return nfsi->layout;
|
|
||||||
}
|
|
||||||
spin_unlock(&ino->i_lock);
|
spin_unlock(&ino->i_lock);
|
||||||
new = alloc_init_layout_hdr(ino, ctx, gfp_flags);
|
new = alloc_init_layout_hdr(ino, ctx, gfp_flags);
|
||||||
spin_lock(&ino->i_lock);
|
spin_lock(&ino->i_lock);
|
||||||
|
|
||||||
if (likely(nfsi->layout == NULL)) /* Won the race? */
|
if (likely(nfsi->layout == NULL)) { /* Won the race? */
|
||||||
nfsi->layout = new;
|
nfsi->layout = new;
|
||||||
else
|
return new;
|
||||||
pnfs_free_layout_hdr(new);
|
}
|
||||||
|
pnfs_free_layout_hdr(new);
|
||||||
|
out_existing:
|
||||||
|
pnfs_get_layout_hdr(nfsi->layout);
|
||||||
return nfsi->layout;
|
return nfsi->layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user