diff options
-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 | ||