Re: [PATCH 1/2] fs: truncate blocks outside i_size after generic_file_direct_write error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitri Monakhov <dmonakhov@xxxxxxxxxx> writes:

> We need to remove block that was allocated in generic_file_direct_write()
> if we fail. We have to do it *regardless* to blocksize. At least ext2,
> ext3 and reiserfs interpret (i_size < biggest block) condition as error.
> Fsck will complain about wrong i_size. Then fsck will fix the error
> by changing i_size according to the biggest block. This is bad because
> this blocks contain gurbage from previous write attempt. And result in
> data corruption.
>
> In order to call vmtruncate() we have to hold host->i_mutex. This is true
> for generic_file_aio_write(). In fact occasionally it is also true for all
> generic_file_aio_write_nolock() callers except blockdev. But this situation
> may change someday. This patch fix only generic_write_aio_write() case.
> BTW: update generic_file_direct_write's comment with currently outdated.

Do you have a test case for this, by any chance?

Cheers,

Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux