]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
block: fix infinite loop if the device loses discard capability
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 3 Jul 2018 17:34:22 +0000 (13:34 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commita55264933f12c2fdc28a66841c4724021e8c1caf
treefe17dbe7a846e5b00785fc9d772040b44e4b128a
parentfd11d34906956b1013dedc01e6e4b24b9c9e8bbf
block: fix infinite loop if the device loses discard capability

BugLink: https://bugs.launchpad.net/bugs/1837257
[ Upstream commit b88aef36b87c9787a4db724923ec4f57dfd513f3 ]

If __blkdev_issue_discard is in progress and a device mapper device is
reloaded with a table that doesn't support discard,
q->limits.max_discard_sectors is set to zero. This results in infinite
loop in __blkdev_issue_discard.

This patch checks if max_discard_sectors is zero and aborts with
-EOPNOTSUPP.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Tested-by: Zdenek Kabelac <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
block/blk-lib.c