On Mon, Jan 22, 2024 at 03:22:45PM +0800, Zhihao Cheng wrote: > 在 2024/1/21 7:08, Matthew Wilcox (Oracle) 写道: > > Page cache reads are lockless, so setting the freshly allocated page > > uptodate before we've overwritten it with the data it's supposed to have > > in it will allow a simultaneous reader to see old data. Move the call > > to SetPageUptodate into ubifs_write_end(), which is after we copied the > > new data into the page. > > This solution looks good to me, and I think 'SetPageUptodate' should be > removed from write_begin_slow(slow path) too. I didn't bother because we have just read into the page so it is uptodate. A racing read will see the data from before the write, but that's an acceptable ordering of events.