On 2024/8/1 0:52, Matthew Wilcox wrote: > On Wed, Jul 31, 2024 at 05:13:04PM +0800, Zhang Yi wrote: >> Commit '1cea335d1db1 ("iomap: fix sub-page uptodate handling")' fix a >> race issue when submitting multiple read bios for a page spans more than >> one file system block by adding a spinlock(which names state_lock now) >> to make the page uptodate synchronous. However, the race condition only >> happened between the read I/O submitting and completeing threads, it's >> sufficient to use page lock to protect other paths, e.g. buffered write >> path. After large folio is supported, the spinlock could affect more >> about the buffered write performance, so drop it could reduce some >> unnecessary locking overhead. > > This patch doesn't work. If we get two read completions at the same > time for blocks belonging to the same folio, they will both write to > the uptodate array at the same time. > This patch just drop the state_lock in the buffered write path, doesn't affect the read path, the uptodate setting in the read completion path is still protected the state_lock, please see iomap_finish_folio_read(). So I think this patch doesn't affect the case you mentioned, or am I missing something? Thanks, Yi.