* [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE
@ 2020-08-06 7:32 Lennart Poettering
2020-08-07 8:53 ` Martijn Coenen
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Poettering @ 2020-08-06 7:32 UTC (permalink / raw)
To: Martijn Coenen; +Cc: linux-block, linux-kernel, Jens Axboe, Christoph Hellwig
When LOOP_CONFIGURE is used with LO_FLAGS_PARTSCAN we need to propagate
this into the GENHD_FL_NO_PART_SCAN. LOOP_SETSTATUS does this,
LOOP_CONFIGURE doesn't so far. Effect is that setting up a loopback
device with partition scanning doesn't actually work when LOOP_CONFIGURE
is issued, though it works fine with LOOP_SETSTATUS.
Let's correct that and propagate the flag in LOOP_SETSTATUS too.
Signed-off-by: Lennart Poettering <lennart@poettering.net>
---
drivers/block/loop.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index d18160146226..2f137d6ce169 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1171,6 +1171,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
if (part_shift)
lo->lo_flags |= LO_FLAGS_PARTSCAN;
partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
+ if (partscan)
+ lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN;
/* Grab the block_device to prevent its destruction after we
* put /dev/loopXX inode. Later in __loop_clr_fd() we bdput(bdev).
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE
2020-08-06 7:32 [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE Lennart Poettering
@ 2020-08-07 8:53 ` Martijn Coenen
2020-08-07 15:31 ` Lennart Poettering
0 siblings, 1 reply; 4+ messages in thread
From: Martijn Coenen @ 2020-08-07 8:53 UTC (permalink / raw)
To: Lennart Poettering
Cc: linux-block, LKML, Jens Axboe, Christoph Hellwig, Yang Xu
Hi Lennart,
Thanks again for the patch, I tested it and it looks good to me. I'll
also add a test case to LTP for this. Two minor nits on the patch:
On Thu, Aug 6, 2020 at 9:32 AM Lennart Poettering <mzxreary@0pointer.de> wrote:
> Let's correct that and propagate the flag in LOOP_SETSTATUS too.
Think you meant LOOP_CONFIGURE.
Also, could you add a "Fixes" tag, like:
Fixes: 3448914e8cc5("loop: Add LOOP_CONFIGURE ioctl")
>
> Signed-off-by: Lennart Poettering <lennart@poettering.net>
> ---
> drivers/block/loop.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index d18160146226..2f137d6ce169 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1171,6 +1171,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
> if (part_shift)
> lo->lo_flags |= LO_FLAGS_PARTSCAN;
> partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
> + if (partscan)
> + lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN;
>
> /* Grab the block_device to prevent its destruction after we
> * put /dev/loopXX inode. Later in __loop_clr_fd() we bdput(bdev).
> --
> 2.26.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE
2020-08-07 8:53 ` Martijn Coenen
@ 2020-08-07 15:31 ` Lennart Poettering
2020-08-10 8:04 ` Martijn Coenen
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Poettering @ 2020-08-07 15:31 UTC (permalink / raw)
To: Martijn Coenen; +Cc: linux-block, LKML, Jens Axboe, Christoph Hellwig, Yang Xu
On Fr, 07.08.20 10:53, Martijn Coenen (maco@android.com) wrote:
> Hi Lennart,
>
> Thanks again for the patch, I tested it and it looks good to me. I'll
> also add a test case to LTP for this. Two minor nits on the patch:
>
> On Thu, Aug 6, 2020 at 9:32 AM Lennart Poettering <mzxreary@0pointer.de> wrote:
> > Let's correct that and propagate the flag in LOOP_SETSTATUS too.
>
> Think you meant LOOP_CONFIGURE.
True!
> Also, could you add a "Fixes" tag, like:
>
> Fixes: 3448914e8cc5("loop: Add LOOP_CONFIGURE ioctl")
Thanks for the review. I'll fix this up and send a v2. Are you OK with
me adding your Ack to the patch? And also should this geta cc for
stable?
Thanks,
Lennart
--
Lennart Poettering, Berlin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE
2020-08-07 15:31 ` Lennart Poettering
@ 2020-08-10 8:04 ` Martijn Coenen
0 siblings, 0 replies; 4+ messages in thread
From: Martijn Coenen @ 2020-08-10 8:04 UTC (permalink / raw)
To: Lennart Poettering
Cc: linux-block, LKML, Jens Axboe, Christoph Hellwig, Yang Xu
On Fri, Aug 7, 2020 at 5:31 PM Lennart Poettering <mzxreary@0pointer.de> wrote:
> Thanks for the review. I'll fix this up and send a v2. Are you OK with
> me adding your Ack to the patch?
Yeah, sure!
> And also should this geta cc for stable?
LOOP_CONFIGURE was just added in v5.8, and stable is v5.7 now, so I
don't think that's needed.
Thanks,
Martijn
>
> Thanks,
>
> Lennart
>
> --
> Lennart Poettering, Berlin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-10 8:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 7:32 [PATCH] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE Lennart Poettering
2020-08-07 8:53 ` Martijn Coenen
2020-08-07 15:31 ` Lennart Poettering
2020-08-10 8:04 ` Martijn Coenen
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).