Re: Filling holes in ext2

From: Adrian Cox (adrian@humboldt.co.uk)
Date: Thu Aug 23 2001 - 12:22:46 EST


Andrew Morton wrote:

> It matters. -ac kernels handle this by clearing out the blocks
> on the error path in __block_prepare_write(). If you retest with
> -ac kernels, you should just see zeroes.

That doesn't help. The problem occurs just the same on -ac kernels.

In this case __block_prepare_write() is successful. What happens is that
if __copy_from_user() fails, the block remains mapped but not up to
date. Thus the next read access to the file fetches the garbage data off
disk, and presents it to the user.

The only definitive solutions I can see are:
1) implement an abort_write() method for every filesystem that uses
block_prepare_write()
2) redefine commit_write() to be called on failure as well as success.
3) lock the pages corresponding to the user buffer so that
__copy_from_user() cannot fail.

I like the latter option, as it removes this abort case for ext3 and
could drastically simplify GFS.

-- 
Adrian Cox

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:59 EST