During the port to kernel 7.0 in LP: #2142837 the path to check the mount  
options has been forgotten, leading to them to be not parsed.
This happened because the parsing mechanism has changed in Kernel 7.0, so the 
path needed to be slightly rewritten.
This lead to kernel panics as well in case an option isn't recognized.
Code reviewed by the package maintainer.

Code has been pushed upstream: 
https://github.com/linux-apfs/linux-apfs-rw/pull/114
Code has been merged: 
https://github.com/linux-apfs/linux-apfs-rw/commit/61672f2caf9fd8cd5d73ff01c758fc3d53021f83
Package has been uploaded to personal PPA: 
https://launchpad.net/~alessiofaina/+archive/ubuntu/dkms-build-tests/+packages 
-> 
https://launchpad.net/~alessiofaina/+archive/ubuntu/dkms-build-tests/+sourcepub/18174864/+listing-archive-extra

autopkgtest results
=========================================================================================================
I: Testing if linux-apfs-rw modules are correctly installed.
linux-apfs-rw/0.3.18, 7.0.0-3-generic, x86_64: installed
I: Summary:
I: PASS linux-apfs-rw/0.3.18 6.19.0-9-generic
I: PASS linux-apfs-rw/0.3.18 7.0.0-3-generic
linux-apfs-rw/0.3.18/7.0.0-3-generic/x86_64/log/make.log
linux-apfs-rw/0.3.18/6.19.0-9-generic/x86_64/log/make.log
autopkgtest [09:43:54]: test dkms-autopkgtest: -----------------------]
autopkgtest [09:43:54]: test dkms-autopkgtest:  - - - - - - - - - - results - - 
- - - - - - - -
dkms-autopkgtest     PASS (superficial)
autopkgtest [09:43:55]: @@@@@@@@@@@@@@@@@@@@ summary
dkms-autopkgtest     PASS (superficial)
qemu-system-x86_64: terminating on signal 15 from pid 320804 (/usr/bin/python3)
=========================================================================================================

Full tests on Ubuntu resolute 7.0.0-7 (7.0-rc4)
=========================================================================================================
cicciput:logs$ cat test 
root@ubuntu-resolute:/home/afaina/dkms/resolute/apfs-dkms/after_maintainer# cat 
../tools/mount.sh 
#!/bin/bash

FILENAME="apfs-test.img"

IMG="../tools/testimg/${FILENAME}"

DEBPKG="apfs-dkms_0.3.18-2ubuntu2_all.deb"

if [ ! -f ${IMG} ]; then
        echo "File not found"
        exit 1
fi

dpkg -i ${DEBPKG}
dmesg -C
echo ""
echo  "->>>>>>> Loading apfs"
modprobe apfs
echo ""
echo "->>>>>>> Creating loop"
losetup -fP ${IMG}
# Verify which loop device it was assigned to (e.g., /dev/loop0)
LOOP=$(losetup -a | grep apfs-test.img)
echo ${LOOP}

if [ ! -d /mnt/apfs-test ]; then
        mkdir /mnt/apfs-test
fi
echo ""
echo "->>>>>>> Mounting image - This will fail"
mount -o reawite -t apfs /dev/loop0 /mnt/apfs-test
dmesg -c

echo ""
echo "->>>>>>> Mounting image readonly - This will work"
mount -t apfs /dev/loop0 /mnt/apfs-test
echo ""
echo "->>>>>>> Unmounting image readonly - This will work"
umount /mnt/apfs-test
dmesg -c

echo ""
echo "->>>>>>> Mounting image - This should work"
mount -o readwrite -t apfs /dev/loop0 /mnt/apfs-test
dmesg -c

echo ""
echo "->>>>>>> Checking inside fs"
find /mnt/apfs-test
echo ""
echo "->>>>>>> Unmount"
umount /mnt/apfs-test
dmesg -c

echo ""
echo "->>>>>>> Mounting with vol=0 option - will succeed"
mount -o vol=0 -t apfs /dev/loop0 /mnt/apfs-test
dmesg -c
echo "->>>>>>> Unmount"
umount /mnt/apfs-test
dmesg -c


echo ""
echo "->>>>>>> Mounting with vol=1 option - will fail"
mount -o vol=1 -t apfs /dev/loop0 /mnt/apfs-test
dmesg -c
echo "->>>>>>> Unmount"
umount /mnt/apfs-test
dmesg -c

echo ""
echo "->>>>>>> Removing loop"
losetup -d /dev/loop0
echo ""
echo "->>>>>>> Removing APFS"
rmmod apfs
dmesg -c
apt remove -y apfs-dkms


root@ubuntu-resolute:/home/afaina/dkms/resolute/apfs-dkms/after_maintainer# 
../tools/mount.sh 
Selecting previously unselected package apfs-dkms.
(Reading database ... 245493 files and directories currently installed.)
Preparing to unpack apfs-dkms_0.3.18-2ubuntu2_all.deb ...
Unpacking apfs-dkms (0.3.18-2ubuntu2) ...
Setting up apfs-dkms (0.3.18-2ubuntu2) ...
Loading new linux-apfs-rw/0.3.18 DKMS files...
Building for 6.19.0-9-generic and 7.0.0-6-generic

Building initial module linux-apfs-rw/0.3.18 for 6.19.0-9-generic
Sign command: /usr/bin/kmodsign
Signing key: /var/lib/shim-signed/mok/MOK.priv
Public certificate (MOK): /var/lib/shim-signed/mok/MOK.der

Running the pre_build script... done.
Building module(s)... done.
Signing module /var/lib/dkms/linux-apfs-rw/0.3.18/build/apfs.ko
Installing /lib/modules/6.19.0-9-generic/updates/dkms/apfs.ko
Running depmod... done.

Building initial module linux-apfs-rw/0.3.18 for 7.0.0-6-generic
Sign command: /usr/bin/kmodsign
Signing key: /var/lib/shim-signed/mok/MOK.priv
Public certificate (MOK): /var/lib/shim-signed/mok/MOK.der

Running the pre_build script... done.
Building module(s)... done.
Signing module /var/lib/dkms/linux-apfs-rw/0.3.18/build/apfs.ko
Installing /lib/modules/7.0.0-6-generic/updates/dkms/apfs.ko.zst
Running depmod... done.

->>>>>>> Loading apfs

->>>>>>> Creating loop
/dev/loop0: [0045]:35952853 
(/home/afaina/dkms/resolute/apfs-dkms/tools/testimg/apfs-test.img)

->>>>>>> Mounting image - This will fail
mount: /mnt/apfs-test: wrong fs type, bad option, bad superblock on /dev/loop0, 
missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
[82288.429366] loop0: detected capacity change from 0 to 262144
[82288.434025] APFS (?): invalid mount option reawite

->>>>>>> Mounting image readonly - This will work

->>>>>>> Unmounting image readonly - This will work
[82288.436226] APFS (loop0:0): experimental writes disabled to avoid data loss
[82288.436238] APFS (loop0:0): if you really want them, check the README

->>>>>>> Mounting image - This should work
[82288.440757] APFS (loop0:0): experimental write support is enabled

->>>>>>> Checking inside fs
/mnt/apfs-test
/mnt/apfs-test/linux-apfs-rw
/mnt/apfs-test/linux-apfs-rw/libzbitmap.h
/mnt/apfs-test/linux-apfs-rw/message.c
/mnt/apfs-test/linux-apfs-rw/libzbitmap.o
   <<<...................>>>
/mnt/apfs-test/linux-apfs-rw/unicode.c
/mnt/apfs-test/linux-apfs-rw/inode.o
/mnt/apfs-test/linux-apfs-rw/xfield.o
/mnt/apfs-test/linux-apfs-rw/apfs.mod.c
/mnt/apfs-test/linux-apfs-rw/btree.c
/mnt/apfs-test/linux-apfs-rw/extents.c
/mnt/apfs-test/linux-apfs-rw/super.c

->>>>>>> Unmount

->>>>>>> Mounting with vol=0 option - will succeed
[82288.450734] APFS (loop0:0): experimental writes disabled to avoid data loss
[82288.450744] APFS (loop0:0): if you really want them, check the README
->>>>>>> Unmount

->>>>>>> Mounting with vol=1 option - will fail
mount: /mnt/apfs-test: wrong fs type, bad option, bad superblock on /dev/loop0, 
missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
[82288.456044] APFS (loop0:1): experimental writes disabled to avoid data loss
[82288.456050] APFS (loop0:1): if you really want them, check the README
[82288.456056] APFS (loop0:1): requested volume does not exist 
(apfs_map_volume_super:614)
->>>>>>> Unmount
umount: /mnt/apfs-test: not mounted.

->>>>>>> Removing loop

->>>>>>> Removing APFS
The following packages were automatically installed and are no longer required:
  babeltrace2                            liblttng-ctl0t64         
linux-modules-7.0.0-1-generic
  libbabeltrace2-0                       liblttng-ust-common1t64  
linux-modules-7.0.0-3-generic
  libbabeltrace2-python-plugin-provider  liblttng-ust-ctl6        python3-bt2
Use 'apt autoremove' to remove them.

REMOVING:
  apfs-dkms

Summary:
  Upgrading: 0, Installing: 0, Removing: 1, Not Upgrading: 228
  Freed space: 902 kB

(Reading database ... 245532 files and directories currently installed.)
Removing apfs-dkms (0.3.18-2ubuntu2) ...
Module linux-apfs-rw/0.3.18 for kernel 6.19.0-9-generic (x86_64):
Before uninstall, this module version was ACTIVE on this kernel.
Deleting /lib/modules/6.19.0-9-generic/updates/dkms/apfs.ko
Running depmod... done.

Module linux-apfs-rw/0.3.18 for kernel 7.0.0-6-generic (x86_64):
Before uninstall, this module version was ACTIVE on this kernel.
Deleting /lib/modules/7.0.0-6-generic/updates/dkms/apfs.ko.zst
Running depmod... done.

Deleting module linux-apfs-rw/0.3.18 completely from the DKMS tree.
Scanning processes...                                                           
                          
Scanning candidates...                                                          
                          
Scanning linux images...                                                        
                          

Running kernel seems to be up-to-date.

Restarting services...

Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart [email protected]
 systemctl restart networkd-dispatcher.service
 systemctl restart [email protected]
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
=========================================================================================================

** Patch added: "resolute_ubuntu2_dkms.patch"
   
https://bugs.launchpad.net/ubuntu/+source/linux-apfs-rw/+bug/2144634/+attachment/5953568/+files/resolute_ubuntu2_dkms.patch

** Changed in: linux-apfs-rw (Ubuntu Resolute)
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2144634

Title:
  In Kernel 7.0, the mount options are ignored

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to