Fix 2 more flexfiles issues
Subsystems (2)
PATCH 1/2 pNFS/flexfiles: Fix ff_layout_add_ds_error_locked()
In reply to Trond MyklebustWhen we're merging an old entry into our new entry, we want to ensure that we add the list entry in the correct place.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -1
@@ -254,8 +254,9 @@ ff_layout_add_ds_error_locked(struct nfs4_flexfile_layout *flo, }/* Entries match, so merge "err" into "dserr" */ extend_ds_error (dserr, err->offset, err->length); -list_del (&err->list); +list_replace (&err->list, &dserr->list);kfree (err); +return ; }list_add_tail (&dserr->list, head);
Signature · 1 line
2.9.3
PATCH 2/2 pNFS: Layoutreturn must free the layout after the layout-private data
The layout-private data may depend on the layout and/or the inode still existing when it does post-processing and frees its data, so we need to free them after calling lrp->ld_private.ops->free().
This fixes a mirror list corruption issue in the flexfiles driver.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/nfs4proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +2 -2
@@ -8641,10 +8641,10 @@ static void nfs4_layoutreturn_release(void *calldata)pnfs_layoutreturn_free_lsegs (lo, &lrp->args.stateid, &lrp->args.range, lrp->res.lrs_present ? &lrp->res.stateid :NULL );nfs4_sequence_free_slot (&lrp->res.seq_res); -pnfs_put_layout_hdr (lrp->args.layout); -nfs_iput_and_deactive (lrp->inode);if (lrp->ld_private.ops && lrp->ld_private.ops->free) lrp->ld_private.ops->free (&lrp->ld_private); +pnfs_put_layout_hdr (lrp->args.layout); +nfs_iput_and_deactive (lrp->inode);kfree (calldata);dprintk ("<-- %s\n" , __func__); }
Signature · 1 line
2.9.3
cover Fix 2 more flexfiles issues
Fix a use-after-free case and a list ordering issue.
Trond Myklebust (2):
pNFS/flexfiles: Fix ff_layout_add_ds_error_locked()
pNFS: Layoutreturn must free the layout after the layout-private data
fs/nfs/flexfilelayout/flexfilelayoutdev.c | 3 ++- fs/nfs/nfs4proc.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.9.3