Re: Filling holes in ext2

Andrew Morton (akpm@zip.com.au)
Thu, 23 Aug 2001 10:46:46 -0700


Adrian Cox wrote:
>
> 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.

OK, that code is for IO errors and disk-full.

> 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.

generic_file_write() will mark the page not up-to-date in this case.
I wonder what's actually going on? Perhaps the fact that we've
instantiated a block in ext2 outside i_size?

If you change the error path in -ac's generic_file_write() thusly:

- goto fail_write;
+ status = -EFAULT;
+ goto sync_failure;

does it fix it?

Can you send the code you're using to demonstrate this?

-
-
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/