]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Sep 2025 18:32:19 +0000 (20:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Sep 2025 18:32:19 +0000 (20:32 +0200)
added patches:
revert-loop-avoid-updating-block-size-under-exclusive-owner.patch

queue-6.6/revert-loop-avoid-updating-block-size-under-exclusive-owner.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/revert-loop-avoid-updating-block-size-under-exclusive-owner.patch b/queue-6.6/revert-loop-avoid-updating-block-size-under-exclusive-owner.patch
new file mode 100644 (file)
index 0000000..a25af46
--- /dev/null
@@ -0,0 +1,108 @@
+From ehagberg@janestreet.com  Mon Sep 22 20:31:07 2025
+From: Eric Hagberg <ehagberg@janestreet.com>
+Date: Mon, 22 Sep 2025 13:17:04 -0400
+Subject: Revert "loop: Avoid updating block size under exclusive owner"
+To: gregkh@linuxfoundation.org
+Cc: stable@vger.kernel.org, jack@suse.cz, Eric Hagberg <ehagberg@janestreet.com>
+Message-ID: <20250922171704.3863333-1-ehagberg@janestreet.com>
+
+From: Eric Hagberg <ehagberg@janestreet.com>
+
+Revert commit ce8da5d13d8c2a7b30b2fb376a22e8eb1a70b8bb which is commit
+7e49538288e523427beedd26993d446afef1a6fb upstream.
+
+This reverts commit ce8da5d13d8c ("loop: Avoid updating block size under
+exclusive owner") for the 6.6 kernel, because if the LTP ioctl_loop06 test is
+run with this patch in place, the test will fail, it leaves the host unable to
+kexec into the kernel again (hangs forever) and "losetup -a" will hang on
+attempting to access the /dev/loopN device that the test has set up.
+
+The patch doesn't need to be reverted from 6.12, as it works fine there.
+
+Cc: stable@vger.kernel.org # 6.6.x
+Signed-off-by: Eric Hagberg <ehagberg@janestreet.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/block/loop.c |   38 ++++++++------------------------------
+ 1 file changed, 8 insertions(+), 30 deletions(-)
+
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -1472,36 +1472,19 @@ static int loop_set_dio(struct loop_devi
+       return error;
+ }
+-static int loop_set_block_size(struct loop_device *lo, blk_mode_t mode,
+-                             struct block_device *bdev, unsigned long arg)
++static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
+ {
+       int err = 0;
+-      /*
+-       * If we don't hold exclusive handle for the device, upgrade to it
+-       * here to avoid changing device under exclusive owner.
+-       */
+-      if (!(mode & BLK_OPEN_EXCL)) {
+-              err = bd_prepare_to_claim(bdev, loop_set_block_size, NULL);
+-              if (err)
+-                      return err;
+-      }
+-
+-      err = mutex_lock_killable(&lo->lo_mutex);
+-      if (err)
+-              goto abort_claim;
+-
+-      if (lo->lo_state != Lo_bound) {
+-              err = -ENXIO;
+-              goto unlock;
+-      }
++      if (lo->lo_state != Lo_bound)
++              return -ENXIO;
+       err = blk_validate_block_size(arg);
+       if (err)
+               return err;
+       if (lo->lo_queue->limits.logical_block_size == arg)
+-              goto unlock;
++              return 0;
+       sync_blockdev(lo->lo_device);
+       invalidate_bdev(lo->lo_device);
+@@ -1513,11 +1496,6 @@ static int loop_set_block_size(struct lo
+       loop_update_dio(lo);
+       blk_mq_unfreeze_queue(lo->lo_queue);
+-unlock:
+-      mutex_unlock(&lo->lo_mutex);
+-abort_claim:
+-      if (!(mode & BLK_OPEN_EXCL))
+-              bd_abort_claiming(bdev, loop_set_block_size);
+       return err;
+ }
+@@ -1536,6 +1514,9 @@ static int lo_simple_ioctl(struct loop_d
+       case LOOP_SET_DIRECT_IO:
+               err = loop_set_dio(lo, arg);
+               break;
++      case LOOP_SET_BLOCK_SIZE:
++              err = loop_set_block_size(lo, arg);
++              break;
+       default:
+               err = -EINVAL;
+       }
+@@ -1590,12 +1571,9 @@ static int lo_ioctl(struct block_device
+               break;
+       case LOOP_GET_STATUS64:
+               return loop_get_status64(lo, argp);
+-      case LOOP_SET_BLOCK_SIZE:
+-              if (!(mode & BLK_OPEN_WRITE) && !capable(CAP_SYS_ADMIN))
+-                      return -EPERM;
+-              return loop_set_block_size(lo, mode, bdev, arg);
+       case LOOP_SET_CAPACITY:
+       case LOOP_SET_DIRECT_IO:
++      case LOOP_SET_BLOCK_SIZE:
+               if (!(mode & BLK_OPEN_WRITE) && !capable(CAP_SYS_ADMIN))
+                       return -EPERM;
+               fallthrough;
index b0c77386c2999fe38f40b0a8578f60523d5f9c53..4b19a4c6381118f63a97d340abaed66d05c78d43 100644 (file)
@@ -67,3 +67,4 @@ mptcp-propagate-shutdown-to-subflows-when-possible.patch
 minmax-avoid-overly-complicated-constant-expressions-in-vm-code.patch
 minmax-simplify-and-clarify-min_t-max_t-implementation.patch
 minmax-add-a-few-more-min_t-max_t-users.patch
+revert-loop-avoid-updating-block-size-under-exclusive-owner.patch