public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Cc: "linux-bcache@vger.kernel.org" <linux-bcache@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.com>,
	Xiao Ni <xni@redhat.com>, Bart Van Assche <bvanassche@acm.org>,
	Christoph Hellwig <hch@lst.de>,
	Enzo Matsumiya <ematsumiya@suse.com>,
	Jens Axboe <axboe@kernel.dk>, Evan Green <evgreen@chromium.org>
Subject: Re: [PATCH] block: tolerate 0 byte discard_granularity in __blkdev_issue_discard()
Date: Tue, 4 Aug 2020 22:45:19 +0800	[thread overview]
Message-ID: <06f2bb53-8917-82d6-3e0c-76270cd80e06@suse.de> (raw)
In-Reply-To: <SN4PR0401MB35984D6090CE1B7F1FD06CD59B4A0@SN4PR0401MB3598.namprd04.prod.outlook.com>

On 2020/8/4 22:39, Johannes Thumshirn wrote:
> On 04/08/2020 16:37, Johannes Thumshirn wrote:
>> On 04/08/2020 16:34, Coly Li wrote:
>>> On 2020/8/4 22:31, Johannes Thumshirn wrote:
>>>> On 04/08/2020 16:23, Coly Li wrote:
>>>>> This is the procedure to reproduce the panic,
>>>>>   # modprobe scsi_debug delay=0 dev_size_mb=2048 max_queue=1
>>>>>   # losetup -f /dev/nvme0n1 --direct-io=on
>>>>>   # blkdiscard /dev/loop0 -o 0 -l 0x200
>>>>
>>>> losetup -f /dev/sdX isn't it?
>>>>
>>>
>>> In my case, I use a NVMe SSD as the backing device of the loop device.
>>> Because I don't have a scsi lun.
>>>
>>> And loading scsi_debug module seems necessary, otherwise the discard
>>> process just hang and I cannot see the kernel panic (I don't know why yet).
>>
>> OK, now that's highly interesting. Does it also happen if you back loop with
>> a file? loop_config_discard() has different cases for the different backing devices/files. S
>>
> 
> Damn I didn't want to hit sent....
> 
> Does this (untested) change make a difference:
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 475e1a738560..8a07a89d702e 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -895,6 +895,9 @@ static void loop_config_discard(struct loop_device *lo)
>                 blk_queue_max_write_zeroes_sectors(q,
>                         backingq->limits.max_write_zeroes_sectors);
>  
> +               q->limits.discard_granularity =
> +                       backingq->limits.discard_granularity;
> +
>         /*
>          * We use punch hole to reclaim the free space used by the
>          * image a.k.a. discard. However we do not support discard if
> 

Yes, Ming just posts a patch with a very similar change to loop device
driver.

Coly Li

  reply	other threads:[~2020-08-04 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 14:23 [PATCH] block: tolerate 0 byte discard_granularity in __blkdev_issue_discard() Coly Li
2020-08-04 14:31 ` Johannes Thumshirn
2020-08-04 14:34   ` Coly Li
2020-08-04 14:37     ` Johannes Thumshirn
2020-08-04 14:39       ` Johannes Thumshirn
2020-08-04 14:45         ` Coly Li [this message]
2020-08-04 14:54           ` Johannes Thumshirn
2020-08-04 14:43       ` Coly Li
2020-08-04 23:58 ` Ming Lei
2020-08-05  0:28   ` Martin K. Petersen
2020-08-05  1:54   ` Coly Li
2020-08-05  2:46     ` Ming Lei
2020-08-05  2:52       ` Coly Li

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=06f2bb53-8917-82d6-3e0c-76270cd80e06@suse.de \
    --to=colyli@suse.de \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=ematsumiya@suse.com \
    --cc=evgreen@chromium.org \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=xni@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox