[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f04981be-5dac-c1e9-36a7-762c6bcf4d32@gmail.com>
Date: Wed, 18 Oct 2023 14:45:49 +0800
From: Joseph Qi <jiangqi903@...il.com>
To: Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>
Cc: linux-ext4@...r.kernel.org,
"Ritesh Harjani (IBM)" <ritesh.list@...il.com>,
Gao Xiang <hsiangkao@...ux.alibaba.com>,
Dave Chinner <david@...morbit.com>,
Joseph Qi <joseph.qi@...ux.alibaba.com>
Subject: Re: [PATCH v3] ext4: Properly sync file size update after O_SYNC
direct IO
On 10/13/23 8:13 PM, Jan Kara wrote:
> Gao Xiang has reported that on ext4 O_SYNC direct IO does not properly
> sync file size update and thus if we crash at unfortunate moment, the
> file can have smaller size although O_SYNC IO has reported successful
> completion. The problem happens because update of on-disk inode size is
> handled in ext4_dio_write_iter() *after* iomap_dio_rw() (and thus
> dio_complete() in particular) has returned and generic_file_sync() gets
> called by dio_complete(). Fix the problem by handling on-disk inode size
> update directly in our ->end_io completion handler.
>
> References: https://lore.kernel.org/all/02d18236-26ef-09b0-90ad-030c4fe3ee20@linux.alibaba.com
> Reported-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
> CC: stable@...r.kernel.org
> Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")
> Signed-off-by: Jan Kara <jack@...e.cz>
Tested with the reproducer after applying to 6.6-rc5,
Tested-by: Joseph Qi <joseph.qi@...ux.alibaba.com>
BTW, once backported to older kernel like 5.10, it seems that it depends
on the following commit:
936e114a245b iomap: update ki_pos a little later in iomap_dio_complete
Otherwise, it will fail the following xfstests cases:
generic/091 generic/094 generic/225 generic/263 generic/311 generic/617
Thanks,
Joseph
Powered by blists - more mailing lists