archive mirror
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <>
To: Ming Lei <>
Cc: Jens Axboe <>,
	"" <>,
	Jan Kara <>, Damien Le Moal <>
Subject: Re: [PATCH V2] block: hold ->invalidate_lock in blkdev_fallocate
Date: Tue, 9 Nov 2021 10:46:29 +0000	[thread overview]
Message-ID: <20211109104628.h7fzcmqtbt6gyr7k@shindev> (raw)
In-Reply-To: <>

On Sep 23, 2021 / 10:37, Ming Lei wrote:
> When running ->fallocate(), blkdev_fallocate() should hold
> mapping->invalidate_lock to prevent page cache from being accessed,
> otherwise stale data may be read in page cache.
> Without this patch, blktests block/009 fails sometimes. With this patch,
> block/009 can pass always.
> Also as Jan pointed out, no pages can be created in the discarded area
> while you are holding the invalidate_lock, so remove the 2nd
> truncate_bdev_range().

Hello Ming, Jan, thanks for the fix.

Unfortunately, I still observe block/009 failure on the kernel version 5.15.0,
which includes this fix patch. I found that BLKDISCARD ioctl has the same
problem. I modified blk_ioctl_discard() in same manner, and the block/009
failure goes away. I also found that BLKZEROOUT has the same issue. I will
post two patches for these ioctl. Your reviews will be appreciated.

Best Regards,
Shin'ichiro Kawasaki

      parent reply	other threads:[~2021-11-09 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23  2:37 Ming Lei
2021-09-23 13:31 ` Jan Kara
2021-09-24 17:07 ` Jens Axboe
2021-11-09 10:46 ` Shinichiro Kawasaki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211109104628.h7fzcmqtbt6gyr7k@shindev \ \ \ \ \ \ \
    --subject='Re: [PATCH V2] block: hold ->invalidate_lock in blkdev_fallocate' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).