This bug is awaiting verification that the linux-raspi/5.15.0-1038.41
kernel in -proposed solves the problem. Please test the kernel and
update this bug with the results. If the problem is solved, change the
tag 'verification-needed-jammy-linux-raspi' to 'verification-done-jammy-
linux-raspi'. If the problem still exists, change the tag 'verification-
needed-jammy-linux-raspi' to 'verification-failed-jammy-linux-raspi'.

If verification is not done by 5 working days from today, this fix will
be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how
to enable and use -proposed. Thank you!


** Tags added: kernel-spammed-jammy-linux-raspi-v2 
verification-needed-jammy-linux-raspi

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2015400

Title:
  losetup with mknod fails on jammy with kernel 5.15.0-69-generic

Status in linux package in Ubuntu:
  Invalid
Status in linux source package in Focal:
  Invalid
Status in linux source package in Jammy:
  Fix Committed
Status in linux source package in Lunar:
  Fix Committed
Status in linux source package in Mantic:
  Invalid

Bug description:
  [ Impact ]

   * Regression in the loop block driver in Jammy kernel
     between 5.15.0-67 to 5.15.0-68 (in v5.15.86 stable),
     due to a change in the default behavior (value) of
     kernel parameter `max_loop` (from 0 to 8) in commit:
     `loop: Fix the max_loop commandline argument treatment
     when it is set to 0` (comment #6).

   * Users of loop devices (major 7) with minor >= 8 now
     fail to `open()` a loop device created with `mknod()`.

   * This is a corner case, as most people use `losetup`
     with usual /dev/loopNUMBER (or `--find`) which are
     not affected as it uses a different code path.
     (`losetup` for `/dev/loopNOT-A-NUMBER` is affected.)

   * Workaround: kernel parameter `max_loop=0`.

  [ Test Steps ]

   * Run the test cases (losetup and test-loop.c in comment #6):
     - max_loop not set (default)
     - max_loop=0
     - max_loop=8

   * Verify the default behavior (max_loop not set) is restored.

   * Verify the modified behavior (max_loop is set) is unchanged.

  [ Regression Potential ]

   * Regressions would be limited to the loop block driver,
     more specifically its default behavior (but it's that now)
     or specific usage of max_loop parameter (tested; looks OK).

  [ Other Info ]

   * Patch 1 [1] is not quite a fix, but adds CONFIG guards that
     Patch 2 [2] depends on. (Alternatively, a Patch 2 backport
     with that could be done, but Patch 1 seems trivial enough.)

   * The fix on Jammy is only Patch 2, with a trivial backport
     (that CONFIG option is not in Jammy/v5.15, only in v5.18).

   * The fix on Lunar is both patches; clean cherry-picks.

   * The fix on Mantic is both patches too,
     now in v6.5-rc3, which should be automatically incorporated
     as Mantic apparently will release with the 6.5 kernel [3]

     [1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23881aec85f3219e8462e87c708815ee2cd82358
     [2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bb5faa99f0ce40756ab7bbbce4f16c01ca5ebd5a
     [3] 
https://discourse.ubuntu.com/t/introducing-kernel-6-5-for-the-23-10-mantic-minotaur-release

  Original Description:
  ---

  losetup fails with devices created manually by mknod on kernel
  5.15.0-69-generic

  # fallocate -l 1G test
  # mknod -m 660 /dev/loop8 b 7 8
  # chown root:disk /dev/loop8
  # losetup /dev/loop8 ./test
  losetup: ./test: failed to set up loop device: Device or resource busy

  Possibly as a result of this patch:
  
https://lore.kernel.org/lkml/20221208200605.756287-1-isaacmanjar...@google.com/T/

  which was introduced in 5.15.0-68:
  
http://launchpadlibrarian.net/653145495/linux_5.15.0-67.74_5.15.0-68.75.diff.gz

  On a machine prior to this change (no issue with losetup):
  # cat /sys/module/loop/parameters/max_loop
  0
  # uname -r
  5.15.0-58-generic

  On a machine after the change (has losetup issue as described above):
  # cat /sys/module/loop/parameters/max_loop
  8
  # uname -r
  5.15.0-69-generic

  So it looks like the default changed and the max amount of loop
  devices that can be created with mknod (not loop-control) is 8. If we
  set max_loop=0 on the kernel command line, it works as before. Cannot
  unload and reload module on a running system to change the parameter
  because it is built into the kernel.

  Another workaround is to use `losetup --find` but that means you
  cannot create with named devices created with mknod.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2015400/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to