lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SN4PR0401MB35984D6090CE1B7F1FD06CD59B4A0@SN4PR0401MB3598.namprd04.prod.outlook.com>
Date:   Tue, 4 Aug 2020 14:39:56 +0000
From:   Johannes Thumshirn <Johannes.Thumshirn@....com>
To:     Coly Li <colyli@...e.de>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>
CC:     "linux-bcache@...r.kernel.org" <linux-bcache@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Ming Lei <ming.lei@...hat.com>,
        Hannes Reinecke <hare@...e.com>, Xiao Ni <xni@...hat.com>,
        Bart Van Assche <bvanassche@....org>,
        Christoph Hellwig <hch@....de>,
        Enzo Matsumiya <ematsumiya@...e.com>,
        Jens Axboe <axboe@...nel.dk>, Evan Green <evgreen@...omium.org>
Subject: Re: [PATCH] block: tolerate 0 byte discard_granularity in
 __blkdev_issue_discard()

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ