Commit 1013df61 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Trond Myklebust

pnfs: do not pass uninitialized lsegs to ->free_lseg

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 2e11f829
...@@ -1358,6 +1358,9 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) ...@@ -1358,6 +1358,9 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
goto out; goto out;
} }
init_lseg(lo, lseg);
lseg->pls_range = res->range;
spin_lock(&ino->i_lock); spin_lock(&ino->i_lock);
if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) { if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
dprintk("%s forget reply due to recall\n", __func__); dprintk("%s forget reply due to recall\n", __func__);
...@@ -1375,8 +1378,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) ...@@ -1375,8 +1378,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
/* Done processing layoutget. Set the layout stateid */ /* Done processing layoutget. Set the layout stateid */
pnfs_set_layout_stateid(lo, &res->stateid, false); pnfs_set_layout_stateid(lo, &res->stateid, false);
init_lseg(lo, lseg);
lseg->pls_range = res->range;
pnfs_get_lseg(lseg); pnfs_get_lseg(lseg);
pnfs_layout_insert_lseg(lo, lseg); pnfs_layout_insert_lseg(lo, lseg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment