Bug 771641

Summary: F16: loop device is not partitionable; rawhide works fine
Product: [Fedora] Fedora Reporter: Jim Meyering <meyering>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-26 15:54:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jim Meyering 2012-01-04 12:52:04 UTC
Description of problem: loop device has ext_range of 1 == not partitionable

Version-Release number of selected component (if applicable): 3.1.6-1.fc16.x86_64

How reproducible: every time

Steps to Reproduce:
1. truncate -s10m a && t=$(losetup --show -f a)
2. cat /sys/devices/virtual/block/$(basename $t)/ext_range
3.
  
Actual results: 1

Expected results: 256

Additional info:

With the current behavior, one cannot partition a loop device on F16,
but one can on rawhide.  This induces test failures at least with GNU parted.

Comment 1 Josh Boyer 2012-01-04 14:51:23 UTC
(In reply to comment #0)
> Description of problem: loop device has ext_range of 1 == not partitionable
> 
> Version-Release number of selected component (if applicable):
> 3.1.6-1.fc16.x86_64
> 
> How reproducible: every time
> 
> Steps to Reproduce:
> 1. truncate -s10m a && t=$(losetup --show -f a)
> 2. cat /sys/devices/virtual/block/$(basename $t)/ext_range
> 3.
> 
> Actual results: 1
> 
> Expected results: 256
> 
> Additional info:
> 
> With the current behavior, one cannot partition a loop device on F16,
> but one can on rawhide.  This induces test failures at least with GNU parted.

The behavior that changes ext_range to 256 seems to be newly added in the 3.2 kernel.  F14 (2.6.35) also defaults to 1.  That's why rawhide shows different behavior.

It was added to loop.c in 3.2 with commit:

loop: always allow userspace partitions and optionally support automatic scanning (e03c8dd14915f)

which ors in the GENHD_FL_EXT_DEVT flag for the disk structure for the loop device.  That tells disk_max_part to always return DISK_MAX_PARTS (256), which is what ext_range represents.

Are you seeing this as a regression somewhere, or is GNU parted making an incorrect assumption?  I doubt this is an actual _bug_ in F16, since the desired behavior you expect is new...

If you really need to make F16 match, you can use the max_parts module parameter for the loop module I think.

Comment 2 Jim Meyering 2012-01-04 15:29:01 UTC
(In reply to comment #1)
> (In reply to comment #0)
...
> > With the current behavior, one cannot partition a loop device on F16,
> > but one can on rawhide.  This induces test failures at least with GNU parted.
>
> The behavior that changes ext_range to 256 seems to be newly added in the 3.2
> kernel.  F14 (2.6.35) also defaults to 1.  That's why rawhide shows different
> behavior.

Hi Josh,
Thanks for the quick reply.

> It was added to loop.c in 3.2 with commit:
> loop: always allow userspace partitions and optionally support automatic
> scanning (e03c8dd14915f)

Ah ha.  For some reason, I thought that behavior was expected to be in 3.1.
Maybe because folks using some other distribution (one that typically lags
behind Fedora) were saying it worked fine for them.  Now, I have to conclude
that they were using a 3.2 kernel or 3.1 with that bit back-ported.

> which ors in the GENHD_FL_EXT_DEVT flag for the disk structure for the loop
> device.  That tells disk_max_part to always return DISK_MAX_PARTS (256), which
> is what ext_range represents.
>
> Are you seeing this as a regression somewhere, or is GNU parted making an
> incorrect assumption?  I doubt this is an actual _bug_ in F16, since the
> desired behavior you expect is new...

You're welcome to close it NOTABUG.

> If you really need to make F16 match, you can use the max_parts module
> parameter for the loop module I think.

The existing test does this, (it's "max_part")

    # If the loop module is loaded, unload it first
    if lsmod | grep '^loop[[:space:]]'; then
	rmmod loop || fail=1
    fi

    # Insert loop module with max_part > 1
    modprobe loop max_part=7 || fail=1

but that modprobe appears to have no effect on my F16 system:

    # lsmod|grep loop
    [Exit 1]
    # modprobe loop max_part=7
    # lsmod|grep loop
    [Exit 1]

Comment 3 Dave Jones 2012-01-04 15:40:38 UTC
we have it built-in.
does tweaking /sys/module/loop/parameters/max_part do what you need ?

Comment 4 Jim Meyering 2012-01-04 16:17:38 UTC
Hi Dave,
Thanks for the suggestion.
Is there some trick to doing this?

   $ echo 7 > /sys/module/loop/parameters/max_part
   zsh: permission denied: /sys/module/loop/parameters/max_part
   [Exit 1]

Comment 5 Dave Jones 2012-01-04 16:26:44 UTC
bah, it's not writeable. That's unfortunate.

Comment 6 Dave Jones 2012-03-22 16:45:15 UTC
[mass update]
kernel-3.3.0-4.fc16 has been pushed to the Fedora 16 stable repository.
Please retest with this update.

Comment 7 Dave Jones 2012-03-22 16:49:42 UTC
[mass update]
kernel-3.3.0-4.fc16 has been pushed to the Fedora 16 stable repository.
Please retest with this update.

Comment 8 Dave Jones 2012-03-22 16:59:09 UTC
[mass update]
kernel-3.3.0-4.fc16 has been pushed to the Fedora 16 stable repository.
Please retest with this update.

Comment 9 Jim Meyering 2012-03-24 14:41:06 UTC
Thanks. With that update to 3.3, the test now passes.