On Sun, 24 Nov 2024 at 14:34, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > Could we just do: > > again: > nsec = READ_ONCE(inode->nsec) > sec = READ_ONCE(inode->sec) > if (READ_ONCE(inode->nsec) != nsec) > goto again; No. You would need to use the right memory ordering barriers. And make sure the writes are in the right order. And even then it wouldn't protect against the race in theory, since two (separate) time writes could make that nsec check work, even when the 'sec' read wouldn't necessarily match *either* of the matching nsec cases. So it might catch some case of value tearing, and make a "this happens in once in a blue moon" turn into a "this happens once in five blue moons" situation instead. But anybody who really cares about this case would presumably still care about the "once in five blue moons" case too. Linus