[pnfs] [PATCH 4/5] pnfs: delete layout segment from list in destroy_lseg
Benny Halevy
bhalevy at panasas.com
Sun Feb 3 05:15:47 EST 2008
On Feb. 01, 2008, 21:14 +0200, andros at umich.edu wrote:
> From: Andy Adamson <andros at umich.edu>
>
> put_lseg() can call destroy_lseg() from various points in the code. Move
> the deletion of the layout segement from the layout segment list into
> destroy_lseg() to guarantee deletion from the list prior to freeing the
> layout segment.
>
> Signed-off-by: Andy Adamson<andros at umich.edu>
> ---
> fs/nfs/pnfs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 3f34f34..4b97147 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -371,6 +371,7 @@ destroy_lseg(struct kref *kref)
> struct pnfs_layout_segment *lseg =
> container_of(kref, struct pnfs_layout_segment, kref);
>
> + list_del_init(&lseg->fi_list);
> PNFS_LD_IO_OPS(lseg->layout)->free_lseg(lseg);
> }
>
> @@ -503,7 +504,6 @@ pnfs_free_layout(struct pnfs_layout_type *lo,
> "offset %llu length %lld\n", __FUNCTION__,
> lseg, lseg->range.iomode, lseg->range.offset,
> lseg->range.length);
> - list_del(&lseg->fi_list);
> put_lseg(lseg);
> }
>
NAK...
You still want to delete the lseg from the list as soon as it is freed
even if it is still referenced so it can't be found from this point on.
Last one to dereference the lseg will destroy it by freeing its memory.
Benny
More information about the pNFS
mailing list