OGAWA Hirofumi 07bfa4415a fat: work around race with userspace's read via blockdev while mounting
If userspace reads the buffer via blockdev while mounting,
sb_getblk()+modify can race with buffer read via blockdev.

For example,

            FS                               userspace
    bh = sb_getblk()
    modify bh->b_data
                                  read
				    ll_rw_block(bh)
				      fill bh->b_data by on-disk data
				      /* lost modified data by FS */
				      set_buffer_uptodate(bh)
    set_buffer_uptodate(bh)

Userspace should not use the blockdev while mounting though, the udev
seems to be already doing this.  Although I think the udev should try to
avoid this, workaround the race by small overhead.

Link: http://lkml.kernel.org/r/87pnk7l3sw.fsf_-_@mail.parknet.co.jp
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reported-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-24 15:54:06 -07:00
..
2019-08-30 07:27:18 -07:00
2019-09-02 11:43:54 +01:00
2019-09-18 17:29:31 -07:00
2019-09-21 10:26:24 -07:00
2019-09-19 09:42:37 -07:00
2019-09-19 13:09:28 -07:00
2019-07-12 17:37:53 -07:00
\n
2019-09-21 13:53:34 -07:00
2019-09-21 14:26:33 -07:00
2019-07-25 11:05:11 +02:00
2019-09-19 09:42:37 -07:00
2019-09-19 09:42:37 -07:00
2019-07-03 17:52:09 -04:00
2019-09-19 09:42:37 -07:00
2019-09-19 10:21:35 -07:00
2019-09-21 10:07:42 -07:00
2019-08-30 08:11:25 -07:00
\n
2019-07-10 20:09:17 -07:00
2019-09-19 09:42:37 -07:00
2019-09-19 09:42:37 -07:00
2019-09-18 17:35:20 -07:00
2019-07-15 21:20:52 -07:00
2019-04-08 18:21:02 -05:00
2019-03-08 14:48:40 -08:00
2019-08-30 07:27:17 -07:00
2019-09-18 16:59:14 -07:00
2019-09-18 16:59:14 -07:00
2019-02-07 16:38:35 +01:00
2019-08-01 20:51:23 +02:00