1 From: Andrea Arcangeli <andrea@suse.de>
2 Subject: Race condition in userspace testcase
3 References: 46948, LTC11574
6 Additional Comment #103 From Andrea Arcangeli 2004-10-15 19:41
7 the last patch I attached is the safest I believe.
9 I'm not sure if a lock_unlock or lock_unlock is always guaranteed to happen
10 after the I/O, and this makes sure no race can happen anymore.
13 fs/bio.c | 10 ++++++++++
14 1 file changed, 10 insertions(+)
18 @@ -1192,6 +1192,16 @@ void bio_endio(struct bio *bio, int erro
19 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
22 + if (bio_data_dir(bio) == READ)
24 + * If the current cpu has written to the page by hand
25 + * without dma, we must enforce ordering to be sure
26 + * this written data will be visible before we expose
27 + * the page contents to other cpus (for example with
33 bio->bi_end_io(bio, error);