xfs
[Top] [All Lists]

Re: [PATCH 7/9] xfs: do not do pointer arithmetics on extent records

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 7/9] xfs: do not do pointer arithmetics on extent records
From: Alex Elder <aelder@xxxxxxx>
Date: Tue, 24 May 2011 19:31:47 -0500
Cc: <xfs@xxxxxxxxxxx>
In-reply-to: <20110511150712.651478046@xxxxxxxxxxxxxxxxxxxxxx>
References: <20110511150402.258164661@xxxxxxxxxxxxxxxxxxxxxx> <20110511150712.651478046@xxxxxxxxxxxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Wed, 2011-05-11 at 11:04 -0400, Christoph Hellwig wrote:
> We need to call xfs_iext_get_ext for the previous extent to get a valid
> pointer, and can't just do pointer arithmetics as they might be in
> different pages.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Wow, that one's nasty.  Did someone find this by hitting it?

Looks good.

Reviewed-by: Alex Elder <aelder@xxxxxxx>

> Index: xfs/fs/xfs/xfs_bmap.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_bmap.c        2011-05-11 10:16:58.847733078 +0200
> +++ xfs/fs/xfs/xfs_bmap.c     2011-05-11 10:17:04.803235692 +0200
> @@ -5145,9 +5145,12 @@ xfs_bunmapi(
>                                */
>                               ASSERT(bno >= del.br_blockcount);
>                               bno -= del.br_blockcount;
> -                             if (bno < got.br_startoff) {
> -                                     if (--lastx >= 0)
> -                                             xfs_bmbt_get_all(--ep, &got);
> +                             if (got.br_startoff > bno) {
> +                                     if (--lastx >= 0) {
> +                                             ep = xfs_iext_get_ext(ifp,
> +                                                                   lastx);
> +                                             xfs_bmbt_get_all(ep, &got);
> +                                     }
>                               }
>                               continue;
>                       } else if (del.br_state == XFS_EXT_UNWRITTEN) {
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs



<Prev in Thread] Current Thread [Next in Thread>