loop: Fix missing discard support when using LOOP_CONFIGURE
authorKristian Klausen <kristian@klausen.dk>
Fri, 18 Jun 2021 11:51:57 +0000 (13:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:55:46 +0000 (16:55 +0200)
commita7e18f57eddf19d5b36a6ac09920d32d9eeb6678
tree00fdcc5b4d4c39bf64c48d837757bc4ebacae8cb
parent75395690e5e6f17c6cf583c5d5e8cc686d4120c5
loop: Fix missing discard support when using LOOP_CONFIGURE

commit 2b9ac22b12a266eb4fec246a07b504dd4983b16b upstream.

Without calling loop_config_discard() the discard flag and parameters
aren't set/updated for the loop device and worst-case they could
indicate discard support when it isn't the case (ex: if the
LOOP_SET_STATUS ioctl was used with a different file prior to
LOOP_CONFIGURE).

Cc: <stable@vger.kernel.org> # 5.8.x-
Fixes: 3448914e8cc5 ("loop: Add LOOP_CONFIGURE ioctl")
Signed-off-by: Kristian Klausen <kristian@klausen.dk>
Link: https://lore.kernel.org/r/20210618115157.31452-1-kristian@klausen.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/loop.c