READ_ONCE does not imply a read memory barrier in the presence of control dependencies between two separate memory locations (flags and data). On x86 TSO, reading from the data page might be reordered before the flags read. See chapter CONTROL DEPENDENCIES in https://www.kernel.org/doc/Documentation/memory-barriers.txt Signed-off-by: Heiner Litz <hlitz@xxxxxxxx> --- drivers/lightnvm/pblk-rb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c index a81a97e..5f09983 100644 --- a/drivers/lightnvm/pblk-rb.c +++ b/drivers/lightnvm/pblk-rb.c @@ -545,6 +545,9 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd, goto try; } + /* Observe control dependency between flags and data read */ + smp_rmb(); + page = virt_to_page(entry->data); if (!page) { pr_err("pblk: could not allocate write bio page\n"); -- 2.7.4