Re: [PATCH 06/11] xfs: take the ilock around xfs_bmapi_read in xfs_zero_remaining_bytes

Dave Chinner
2013-12-08T22:37:13Z

On Fri, Dec 06, 2013 at 12:30:12PM -0800, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/xfs/xfs_bmap_util.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_bmap_util.c 2013-12-06 19:37:36.715162723 +0100
> +++ xfs/fs/xfs/xfs_bmap_util.c 2013-12-06 19:38:45.643161309 +0100
> @@ -1175,9 +1175,15 @@ xfs_zero_remaining_bytes(
> xfs_buf_unlock(bp);
>
> for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
> + uint lock_mode;
> +
> offset_fsb = XFS_B_TO_FSBT(mp, offset);
> nimap = 1;
> +
> + lock_mode = xfs_ilock_data_map_shared(ip);
> error = xfs_bmapi_read(ip, offset_fsb, 1, &imap, &nimap, 0);
> + xfs_iunlock(ip, lock_mode);
> +
> if (error || nimap < 1)
> break;
> ASSERT(imap.br_blockcount >= 1);

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

--
Dave Chinner
david@fromorbit.com