Re: [Patch v2 09/42] btrfs: refactor how we finish ordered extent io for endio functions
From: David Sterba <hidden>
Date: 2021-05-13 23:14:01
From: David Sterba <hidden>
Date: 2021-05-13 23:14:01
On Wed, Apr 28, 2021 at 07:03:16AM +0800, Qu Wenruo wrote:
+ if (entry->bytes_left == 0) {
+ set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
+ /* set_bit implies a barrier */
+ cond_wake_up_nomb(&entry->wait);Well, no, set_bit does not imply a barrier. In general, RMW operations do, and set_bit lacks the 'R' part. It's also in the memory-barriers.txt document, look up set_bit. I inserted a patch that does cond_wake_up that does the barrier, calling smp_mb_after_atomic + cond_wake_up_nomb would also work.