Skip to content

Commit

Permalink
pnfs: do not pass uninitialized lsegs to ->free_lseg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Trond Myklebust committed Sep 10, 2014
1 parent 2e11f82 commit 1013df6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand All @@ -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);

Expand Down

0 comments on commit 1013df6

Please sign in to comment.