On Tue, May 23, 2023 at 11:43:32PM -0700, Christoph Hellwig wrote: > On Tue, May 23, 2023 at 12:35:35PM -0400, Kent Overstreet wrote: > > No, this is fundamentally because userspace controls the ordering of > > locking because the buffer passed to dio can point into any address > > space. You can't solve this by changing the locking heirarchy. > > > > If you want to be able to have locking around adding things to the > > pagecache so that things that bypass the pagecache can prevent > > inconsistencies (and we do, the big one is fcollapse), and if you want > > dio to be able to use that same locking (because otherwise dio will also > > cause page cache inconsistency), this is the way to do it. > > Well, it seems like you are talking about something else than the > existing cases in gfs2 and btrfs, that is you want full consistency > between direct I/O and buffered I/O. That's something nothing in the > kernel has ever provided, so I'd be curious why you think you need it > and want different semantics from everyone else? Because I like code that is correct.