On Fri, Mar 08, 2024 at 09:41:14AM -0500, Bruce Ashfield wrote:
> > Hmmm . . . Bruce said that the ubuntu patch didn't apply for him, so I
> > haven't tried that.
> >
> > Do you have a kirkstone patch that I can try on the autobuilder?
> >
> 
> I'd still rather not go the ubuntu patch route. It is my last choice in the
> options.
> 
> If this is caused by upstream commits, there should also be upstream
> commits that fix the issues. I need to identify those commits and
> document why they aren't appropriate for our 5.15 kernel before I pick
> up someone's else patch .. since at that point, I have no idea about their
> logic and other issues it may introduce.

Agreed. But that patch is indeed a backport of upstream commit b9684a71fca7 and
the tweak in order to port to v5.15 also seems pretty reasonable. I generated
a patch based on the latest kirkstone branch. Steve, could you give the 
attachment
a try?

Thanks,
Kevin
From dca6a0cec06a1688881d697bd255eff05b474c3e Mon Sep 17 00:00:00 2001
From: Kevin Hao <kexin....@windriver.com>
Date: Fri, 8 Mar 2024 22:31:26 +0800
Subject: [PATCH] linux-yocto: Don't merge: Fix the parted ptest failues

Signed-off-by: Kevin Hao <kexin....@windriver.com>
---
 ...-support-partitions-without-scanning.patch | 104 ++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto_5.15.bb |   3 +-
 2 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-kernel/linux/files/0001-block-loop-support-partitions-without-scanning.patch

diff --git 
a/meta/recipes-kernel/linux/files/0001-block-loop-support-partitions-without-scanning.patch
 
b/meta/recipes-kernel/linux/files/0001-block-loop-support-partitions-without-scanning.patch
new file mode 100644
index 000000000000..f77b0e9eb00a
--- /dev/null
+++ 
b/meta/recipes-kernel/linux/files/0001-block-loop-support-partitions-without-scanning.patch
@@ -0,0 +1,104 @@
+From 82fad6e9334f1239fe090def17ca947c89fc4308 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <h...@lst.de>
+Date: Fri, 27 May 2022 07:58:06 +0200
+Subject: [PATCH] block, loop: support partitions without scanning
+
+BugLink: https://bugs.launchpad.net/bugs/2056143
+
+Historically we did distinguish between a flag that surpressed partition
+scanning, and a combinations of the minors variable and another flag if
+any partitions were supported.  This was generally confusing and doesn't
+make much sense, but some corner case uses of the loop driver actually
+do want to support manually added partitions on a device that does not
+actively scan for partitions.  To make things worsee the loop driver
+also wants to dynamically toggle the scanning for partitions on a live
+gendisk, which makes the disk->flags updates non-atomic.
+
+Introduce a new GD_SUPPRESS_PART_SCAN bit in disk->state that disables
+just scanning for partitions, and toggle that instead of GENHD_FL_NO_PART
+in the loop driver.
+
+Upstream-Status: Backport [c3032b60ff7b3948325b8f2bd688b9a74be3cfb9]
+
+Fixes: 1ebe2e5f9d68 ("block: remove GENHD_FL_EXT_DEVT")
+Reported-by: Ming Lei <ming....@redhat.com>
+Signed-off-by: Christoph Hellwig <h...@lst.de>
+Reviewed-by: Ming Lei <ming....@redhat.com>
+Link: https://lore.kernel.org/r/20220527055806.1972352-1-...@lst.de
+Signed-off-by: Jens Axboe <ax...@kernel.dk>
+
+(backported from commit b9684a71fca793213378dd410cd11675d973eaa1)
+[smb: Flag and test for partition scan in genhd.h instead]
+Signed-off-by: Stefan Bader <stefan.ba...@canonical.com>
+Acked-by: Roxana Nicolescu <roxana.nicole...@canonical.com>
+Acked-by: Manuel Diewald <manuel.diew...@canonical.com>
+Signed-off-by: Stefan Bader <stefan.ba...@canonical.com>
+---
+ drivers/block/loop.c  | 8 ++++----
+ include/linux/genhd.h | 3 +++
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index 4769caab9ff9..a76302450c46 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -1332,7 +1332,7 @@ static int loop_configure(struct loop_device *lo, 
fmode_t mode,
+               lo->lo_flags |= LO_FLAGS_PARTSCAN;
+       partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
+       if (partscan)
+-              lo->lo_disk->flags &= ~GENHD_FL_NO_PART;
++              clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
+ 
+       /* enable and uncork uevent now that we are done */
+       dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
+@@ -1481,7 +1481,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool 
release)
+       mutex_lock(&lo->lo_mutex);
+       lo->lo_flags = 0;
+       if (!part_shift)
+-              lo->lo_disk->flags |= GENHD_FL_NO_PART;
++              set_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
+       lo->lo_state = Lo_unbound;
+       mutex_unlock(&lo->lo_mutex);
+ 
+@@ -1598,7 +1598,7 @@ loop_set_status(struct loop_device *lo, const struct 
loop_info64 *info)
+ 
+       if (!err && (lo->lo_flags & LO_FLAGS_PARTSCAN) &&
+            !(prev_lo_flags & LO_FLAGS_PARTSCAN)) {
+-              lo->lo_disk->flags &= ~GENHD_FL_NO_PART;
++              clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
+               partscan = true;
+       }
+ out_unlock:
+@@ -2428,7 +2428,7 @@ static int loop_add(int i)
+        * userspace tools. Parameters like this in general should be avoided.
+        */
+       if (!part_shift)
+-              disk->flags |= GENHD_FL_NO_PART;
++              set_bit(GD_SUPPRESS_PART_SCAN, &disk->state);
+       disk->flags |= GENHD_FL_EXT_DEVT;
+       atomic_set(&lo->lo_refcnt, 0);
+       mutex_init(&lo->lo_mutex);
+diff --git a/include/linux/genhd.h b/include/linux/genhd.h
+index 690b7f7996d1..fc69ab1751c2 100644
+--- a/include/linux/genhd.h
++++ b/include/linux/genhd.h
+@@ -132,6 +132,7 @@ struct gendisk {
+ #define GD_READ_ONLY                  1
+ #define GD_DEAD                               2
+ #define GD_NATIVE_CAPACITY            3
++#define GD_SUPPRESS_PART_SCAN         5
+ 
+       struct mutex open_mutex;        /* open/close mutex */
+       unsigned open_partitions;       /* number of open partitions */
+@@ -185,6 +186,8 @@ static inline int disk_max_parts(struct gendisk *disk)
+ 
+ static inline bool disk_part_scan_enabled(struct gendisk *disk)
+ {
++      if (test_bit(GD_SUPPRESS_PART_SCAN, &disk->state))
++              return 0;
+       return disk_max_parts(disk) > 1 && !(disk->flags & GENHD_FL_NO_PART);
+ }
+ 
+-- 
+2.44.0
+
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.15.bb 
b/meta/recipes-kernel/linux/linux-yocto_5.15.bb
index 9a7c96b4539a..8f63a4954fc4 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.15.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.15.bb
@@ -36,7 +36,8 @@ PN:class-devupstream = "linux-yocto-upstream"
 KBRANCH:class-devupstream = "v5.15/base"
 
 SRC_URI = 
"git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \
-           
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}"
+           
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}
 \
+           file://0001-block-loop-support-partitions-without-scanning.patch"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 LINUX_VERSION ?= "5.15.148"
-- 
2.44.0

Attachment: signature.asc
Description: PGP signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196853): 
https://lists.openembedded.org/g/openembedded-core/message/196853
Mute This Topic: https://lists.openembedded.org/mt/104794844/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to