xfs
[Top] [All Lists]

Re: [PATCH, RFC] directory offset overflows in 2.6.28

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH, RFC] directory offset overflows in 2.6.28
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 30 Dec 2008 11:11:17 +1100
Cc: xfs@xxxxxxxxxxx, John Stanley <jpsinthemix@xxxxxxxxxxx>
In-reply-to: <20081229220745.GA12966@xxxxxxxxxxxxx>
Mail-followup-to: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, John Stanley <jpsinthemix@xxxxxxxxxxx>
References: <20081229220745.GA12966@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.18 (2008-05-17)
On Mon, Dec 29, 2008 at 05:07:45PM -0500, Christoph Hellwig wrote:
> The patch below is a dumb version of just putting back the masking,
> to make sure we have the same behavior as in 2.6.27 and earlier.
> I think we should at least hide it in a macro that is well-commented,
> but I suspect we also need to make sure that we never ever get bigger
> offsets in directories in some way.

I think we need that macro sooner rather than later ;)

> Index: xfs/fs/xfs/xfs_dir2_block.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_dir2_block.c  2008-12-29 21:25:29.680613664 +0100
> +++ xfs/fs/xfs/xfs_dir2_block.c       2008-12-29 21:29:57.341627581 +0100
> @@ -517,9 +517,9 @@ xfs_dir2_block_getdents(
>               /*
>                * If it didn't fit, set the final offset to here & return.
>                */
> -             if (filldir(dirent, dep->name, dep->namelen, cook,
> +             if (filldir(dirent, dep->name, dep->namelen, cook & 0x7fffffff,
>                           ino, DT_UNKNOWN)) {
> -                     *offset = cook;
> +                     *offset = cook & 0x7fffffff;
>                       xfs_da_brelse(NULL, bp);
>                       return 0;
>               }

In this case, you can do the masking at the time cook is
assigned. I haven't checked, but I suspect the rest will be the
same. That will make the patch less invasive and with a macro
somewhat cleaner...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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