diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 18:41:05 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 18:41:05 -0400 |
commit | 251ec410c495cb93c7ae2cb4beda29205d9bd35f (patch) | |
tree | d9f971d9ca4f00ed19a6edb1ea9cd563c51ffe65 /fs | |
parent | ae2bb03236fc978bdf673c19d39832500793b83c (diff) |
NFSv4.1: Fix another refcount issue in pnfs_find_alloc_layout
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-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, | |||
907 | 907 | ||
908 | dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout); | 908 | dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout); |
909 | 909 | ||
910 | if (nfsi->layout) { | 910 | if (nfsi->layout != NULL) |
911 | pnfs_get_layout_hdr(nfsi->layout); | 911 | goto out_existing; |
912 | return nfsi->layout; | ||
913 | } | ||
914 | spin_unlock(&ino->i_lock); | 912 | spin_unlock(&ino->i_lock); |
915 | new = alloc_init_layout_hdr(ino, ctx, gfp_flags); | 913 | new = alloc_init_layout_hdr(ino, ctx, gfp_flags); |
916 | spin_lock(&ino->i_lock); | 914 | spin_lock(&ino->i_lock); |
917 | 915 | ||
918 | if (likely(nfsi->layout == NULL)) /* Won the race? */ | 916 | if (likely(nfsi->layout == NULL)) { /* Won the race? */ |
919 | nfsi->layout = new; | 917 | nfsi->layout = new; |
920 | else | 918 | return new; |
921 | pnfs_free_layout_hdr(new); | 919 | } |
920 | pnfs_free_layout_hdr(new); | ||
921 | out_existing: | ||
922 | pnfs_get_layout_hdr(nfsi->layout); | ||
922 | return nfsi->layout; | 923 | return nfsi->layout; |
923 | } | 924 | } |
924 | 925 | ||