xfs
[Top] [All Lists]

Re: [PATCH 8/9] xfs: fix up asserts in xfs_iflush_fork

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 8/9] xfs: fix up asserts in xfs_iflush_fork
From: Alex Elder <aelder@xxxxxxx>
Date: Tue, 24 May 2011 19:32:01 -0500
Cc: <xfs@xxxxxxxxxxx>
In-reply-to: <20110511150712.830693893@xxxxxxxxxxxxxxxxxxxxxx>
References: <20110511150402.258164661@xxxxxxxxxxxxxxxxxxxxxx> <20110511150712.830693893@xxxxxxxxxxxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Wed, 2011-05-11 at 11:04 -0400, Christoph Hellwig wrote:
> Remove asserts in xfs_iflush_fork that would call xfs_iext_get_ext with
> a potentially invalid extent buffer index.
> 
> Based on an earlier patch from Lachlan McIlroy.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

This states that it's invalid to attempt to
request the first (0th) extent, because it's
invalid if the fork has no extents, right?

Looks good.

Reviewed-by: Alex Elder <aelder@xxxxxxx>

> Index: xfs/fs/xfs/xfs_inode.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_inode.c       2011-05-11 10:18:39.555233397 +0200
> +++ xfs/fs/xfs/xfs_inode.c    2011-05-11 12:04:24.099733330 +0200
> @@ -2557,12 +2557,9 @@ xfs_iflush_fork(
>       case XFS_DINODE_FMT_EXTENTS:
>               ASSERT((ifp->if_flags & XFS_IFEXTENTS) ||
>                      !(iip->ili_format.ilf_fields & extflag[whichfork]));
> -             ASSERT((xfs_iext_get_ext(ifp, 0) != NULL) ||
> -                     (ifp->if_bytes == 0));
> -             ASSERT((xfs_iext_get_ext(ifp, 0) == NULL) ||
> -                     (ifp->if_bytes > 0));
>               if ((iip->ili_format.ilf_fields & extflag[whichfork]) &&
>                   (ifp->if_bytes > 0)) {
> +                     ASSERT(xfs_iext_get_ext(ifp, 0));
>                       ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0);
>                       (void)xfs_iextents_copy(ip, (xfs_bmbt_rec_t *)cp,
>                               whichfork);
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs



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