pnfs: do not pass uninitialized lsegs to ->free_lseg
authorChristoph Hellwig <hch@lst.de>
Thu, 21 Aug 2014 16:09:18 +0000 (11:09 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 10 Sep 2014 19:47:01 +0000 (12:47 -0700)
Ensure the lsegs are initialized early so that we don't pass an unitialized
one back to ->free_lseg during error processing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs.c

index a6586cdee2110780796abaf3af017f4b8a2b94e7..0e0364ca877ddc5d5b63d2d59c1e4fd618a2646f 100644 (file)
@@ -1358,6 +1358,9 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
                goto out;
        }
 
+       init_lseg(lo, lseg);
+       lseg->pls_range = res->range;
+
        spin_lock(&ino->i_lock);
        if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
                dprintk("%s forget reply due to recall\n", __func__);
@@ -1375,8 +1378,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
        /* Done processing layoutget. Set the layout stateid */
        pnfs_set_layout_stateid(lo, &res->stateid, false);
 
-       init_lseg(lo, lseg);
-       lseg->pls_range = res->range;
        pnfs_get_lseg(lseg);
        pnfs_layout_insert_lseg(lo, lseg);