linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Jan Kara <jack@suse.cz>, Damien Le Moal <Damien.LeMoal@wdc.com>
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: <20210923023751.1441091-1-ming.lei@redhat.com>

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20211109104628.h7fzcmqtbt6gyr7k@shindev \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --subject='Re: [PATCH V2] block: hold ->invalidate_lock in blkdev_fallocate' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).