summaryrefslogtreecommitdiff
path: root/include/linux/buffer_head.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2022-10-16 16:06:53 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-10-16 16:06:53 -0700
commit280330fac48280e16454cfa46c368af4812ad79c (patch)
tree18b9ed796c57e3929e50b9b03f2c6501740b03d6 /include/linux/buffer_head.h
parentd0d51a97063db4704a5ef6bc978dddab1636a306 (diff)
parent4fe89d07dcc2804c8b562f6c7896a45643d34b2f (diff)
Merge branch 'master' into mm-hotfixes-stable
Diffstat (limited to 'include/linux/buffer_head.h')
-rw-r--r--include/linux/buffer_head.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 089c9ade4325..df518c429667 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -138,6 +138,17 @@ BUFFER_FNS(Defer_Completion, defer_completion)
static __always_inline void set_buffer_uptodate(struct buffer_head *bh)
{
/*
+ * If somebody else already set this uptodate, they will
+ * have done the memory barrier, and a reader will thus
+ * see *some* valid buffer state.
+ *
+ * Any other serialization (with IO errors or whatever that
+ * might clear the bit) has to come from other state (eg BH_Lock).
+ */
+ if (test_bit(BH_Uptodate, &bh->b_state))
+ return;
+
+ /*
* make it consistent with folio_mark_uptodate
* pairs with smp_load_acquire in buffer_uptodate
*/