linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* LOOP_CONFIGURE ioctl doesn't work if lo_offset/lo_sizelimit are set
@ 2020-08-24 15:44 Lennart Poettering
  2020-08-24 18:24 ` Martijn Coenen
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Poettering @ 2020-08-24 15:44 UTC (permalink / raw)
  To: Martijn Coenen, linux-block, LKML, Jens Axboe, Christoph Hellwig,
	Yang Xu

Hi!

Even with fe6a8fc5ed2f0081f17375ae2005718522c392c6 the LOOP_CONFIGURE
ioctl doesn't work correctly. It gets confused if the
lo_offset/lo_sizelimit fields are set to non-zero.

In a quick test I ran (on Linux 5.8.3) I call LOOP_CONFIGURE with
.lo_offset=3221204992 and .lo_sizelimit=50331648 and immediately
verify the size of the block device with BLKGETSIZE64. It should of
course return 50331648, but actually returns 3271557120. (the precise
values have no particular relevance, it's just what I happened to use
in my test.) If I instead use LOOP_SET_STATUS64 with the exact same
parameters, everything works correctly. In either case, if I use
LOOP_GET_STATUS64 insted of BLKGETSIZE64 to verify things, everything
looks great.

My guess is that the new ioctl simply doesn't properly propagate the
size limit into the underlying block device like it should. I didn't
have the time to investigate further though.

Lennart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LOOP_CONFIGURE ioctl doesn't work if lo_offset/lo_sizelimit are set
  2020-08-24 15:44 LOOP_CONFIGURE ioctl doesn't work if lo_offset/lo_sizelimit are set Lennart Poettering
@ 2020-08-24 18:24 ` Martijn Coenen
  2020-08-25  7:20   ` Martijn Coenen
  0 siblings, 1 reply; 3+ messages in thread
From: Martijn Coenen @ 2020-08-24 18:24 UTC (permalink / raw)
  To: Lennart Poettering
  Cc: linux-block, LKML, Jens Axboe, Christoph Hellwig, Yang Xu

Hi Lennart,

Thanks for the report, I'll look into it. FWIW, we've been using
LOOP_CONFIGURE on Android with lo_offset/lo_sizelimit without issues,
but it may be a particular configuration that's causing issues.

Thanks,
Martijn

On Mon, Aug 24, 2020 at 5:44 PM Lennart Poettering <mzxreary@0pointer.de> wrote:
>
> Hi!
>
> Even with fe6a8fc5ed2f0081f17375ae2005718522c392c6 the LOOP_CONFIGURE
> ioctl doesn't work correctly. It gets confused if the
> lo_offset/lo_sizelimit fields are set to non-zero.
>
> In a quick test I ran (on Linux 5.8.3) I call LOOP_CONFIGURE with
> .lo_offset=3221204992 and .lo_sizelimit=50331648 and immediately
> verify the size of the block device with BLKGETSIZE64. It should of
> course return 50331648, but actually returns 3271557120. (the precise
> values have no particular relevance, it's just what I happened to use
> in my test.) If I instead use LOOP_SET_STATUS64 with the exact same
> parameters, everything works correctly. In either case, if I use
> LOOP_GET_STATUS64 insted of BLKGETSIZE64 to verify things, everything
> looks great.
>
> My guess is that the new ioctl simply doesn't properly propagate the
> size limit into the underlying block device like it should. I didn't
> have the time to investigate further though.
>
> Lennart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LOOP_CONFIGURE ioctl doesn't work if lo_offset/lo_sizelimit are set
  2020-08-24 18:24 ` Martijn Coenen
@ 2020-08-25  7:20   ` Martijn Coenen
  0 siblings, 0 replies; 3+ messages in thread
From: Martijn Coenen @ 2020-08-25  7:20 UTC (permalink / raw)
  To: Lennart Poettering
  Cc: linux-block, LKML, Jens Axboe, Christoph Hellwig, Yang Xu

Hi,

I just sent a patch to fix the issue. The loop device would have
respected the configuration, but indeed the size of the underlying
block device was not set correctly, so reading back the size would
give the wrong result.

Thanks,
Martijn

On Mon, Aug 24, 2020 at 8:24 PM Martijn Coenen <maco@android.com> wrote:
>
> Hi Lennart,
>
> Thanks for the report, I'll look into it. FWIW, we've been using
> LOOP_CONFIGURE on Android with lo_offset/lo_sizelimit without issues,
> but it may be a particular configuration that's causing issues.
>
> Thanks,
> Martijn
>
> On Mon, Aug 24, 2020 at 5:44 PM Lennart Poettering <mzxreary@0pointer.de> wrote:
> >
> > Hi!
> >
> > Even with fe6a8fc5ed2f0081f17375ae2005718522c392c6 the LOOP_CONFIGURE
> > ioctl doesn't work correctly. It gets confused if the
> > lo_offset/lo_sizelimit fields are set to non-zero.
> >
> > In a quick test I ran (on Linux 5.8.3) I call LOOP_CONFIGURE with
> > .lo_offset=3221204992 and .lo_sizelimit=50331648 and immediately
> > verify the size of the block device with BLKGETSIZE64. It should of
> > course return 50331648, but actually returns 3271557120. (the precise
> > values have no particular relevance, it's just what I happened to use
> > in my test.) If I instead use LOOP_SET_STATUS64 with the exact same
> > parameters, everything works correctly. In either case, if I use
> > LOOP_GET_STATUS64 insted of BLKGETSIZE64 to verify things, everything
> > looks great.
> >
> > My guess is that the new ioctl simply doesn't properly propagate the
> > size limit into the underlying block device like it should. I didn't
> > have the time to investigate further though.
> >
> > Lennart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-25  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 15:44 LOOP_CONFIGURE ioctl doesn't work if lo_offset/lo_sizelimit are set Lennart Poettering
2020-08-24 18:24 ` Martijn Coenen
2020-08-25  7:20   ` 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).