Skip to contentSkip to conversation

zram01: Specify filesystem type explicitly in mount

PATCH In review Avinesh Kumar via ltp 4 participants 6 messages May 25 – May 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zram01: Specify filesystem type explicitly in mount

util-linux 2.42 converts "ntfs" to "ntfs3" during auto-detection, causing mount failures on systems with CONFIG_NTFS3_FS disabled even when ntfs-3g is available.

tst_supported_fs_types.c:141: TINFO: FUSE does support ntfs tst_supported_fs_types.c:67: TINFO: mkfs.ntfs does exist tst_supported_fs_types.c:137: TINFO: Filesystem ntfs3 is not supported
...
...
zram01 6 TINFO: mount /dev/zram7
mount: /tmp/LTP_zram01.YG3YHQhMER/zram7: unknown filesystem type 'ntfs3'.
dmesg(1) may have more information after failed mount system call.
zram01 6 TBROK: mount /dev/zram7 zram7 failed

Fix by specifying -t option with the filesystem type that LTP verified as supported, avoiding auto-detection.

---
 testcases/kernel/device-drivers/zram/zram01.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
testcases/kernel/device-drivers/zram/zram01.sh +6 -4
index 793f6603c..4b7f2a753 100755
@@ -94,13 +94,15 @@ zram_makefs()
 
 zram_mount()
 {
-	local i
+	local i=$dev_start
+	local fs
 
-	for i in $(seq $dev_start $dev_end); do
-		tst_res TINFO "mount /dev/zram$i"
+	for fs in $zram_filesystems; do
+		tst_res TINFO "mount /dev/zram$i ($fs)"
 		mkdir zram$i
-		ROD mount /dev/zram$i zram$i
+		ROD mount -t "$fs" /dev/zram$i zram$i
 		dev_mounted=$i
+		i=$((i + 1))
 	done
 
 	tst_res TPASS "mount of zram device(s) succeeded"
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by LTP AI Reviewer on v1 1/1
#1 lore raw

Hi Avinesh,

Quoted 5 lines · Avinesh Kumar

zram01: Specify filesystem type explicitly in mount

testcases/kernel/device-drivers/zram/zram01.sh +1 -2
-	for i in $(seq $dev_start $dev_end); do
-		tst_res TINFO "mount /dev/zram$i"
+	local i=$dev_start

testcases/kernel/device-drivers/zram/zram01.sh zram_makefs() · line 106

Quoted 10 lines
testcases/kernel/device-drivers/zram/zram01.sh +6 -1
+	local fs
+
+	for fs in $zram_filesystems; do
+		tst_res TINFO "mount /dev/zram$i ($fs)"
 		mkdir zram$i
-		ROD mount /dev/zram$i zram$i
+		ROD mount -t "$fs" /dev/zram$i zram$i
 		dev_mounted=$i
+		i=$((i + 1))
 	done

Nit: the rest of the file uses $(($i + 1)) (e.g. zram_makefs). Prefer i=$(($i + 1)) here for consistency.

[...]

---
Note:

Our agent completed the review of the patch. The full review can be found at: https://github.com/linux-test-project/ltp-agent/actions/runs/26416857886

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 5 lines

Hi Avinesh,

Quoted 1 line · Avinesh Kumar

zram01: Specify filesystem type explicitly in mount

Quoted 16 lines

testcases/kernel/device-drivers/zram/zram01.sh zram_makefs() · line 106

Quoted 13 lines
testcases/kernel/device-drivers/zram/zram01.sh +7 -3
-	for i in $(seq $dev_start $dev_end); do
-		tst_res TINFO "mount /dev/zram$i"
+	local i=$dev_start
+	local fs
+
+	for fs in $zram_filesystems; do
+		tst_res TINFO "mount /dev/zram$i ($fs)"
 		mkdir zram$i
-		ROD mount /dev/zram$i zram$i
+		ROD mount -t "$fs" /dev/zram$i zram$i
 		dev_mounted=$i
+		i=$((i + 1))
 	done

Nit: the rest of the file uses $(($i + 1)) (e.g. zram_makefs). Prefer i=$(($i + 1)) here for consistency.

Good catch, but I'd prefer to use the form Avinesh posted (i.e. "i", not "$i"). And it's probably not worth to do the cleanup on the other place (neither in this commit nor in the separate).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#3 lore raw
In reply to Avinesh Kumar via ltp

Hi Avinesh,

Quoted 3 lines

util-linux 2.42 converts "ntfs" to "ntfs3" during auto-detection, causing mount failures on systems with CONFIG_NTFS3_FS disabled even when ntfs-3g is available.

I see from release notes [1]:

The NTFS mount type (kernel FS driver) can be changed by the compile option --with-ntfs-mounttype=, the default is ntfs3.

As you already found I guess it started as PR#3618 [2] but later got fixed/changed as PR#3872 [3] (previous attempt was PR#3807 [4]).

[1] https://github.com/util-linux/util-linux/blob/master/Documentation/releases/v2.42-ReleaseNotes
[2] https://github.com/util-linux/util-linux/pull/3618
[3] https://github.com/util-linux/util-linux/pull/3872
[4] https://github.com/util-linux/util-linux/pull/3807

Quoted 10 lines

tst_supported_fs_types.c:141: TINFO: FUSE does support ntfs tst_supported_fs_types.c:67: TINFO: mkfs.ntfs does exist tst_supported_fs_types.c:137: TINFO: Filesystem ntfs3 is not supported
...
...
zram01 6 TINFO: mount /dev/zram7
mount: /tmp/LTP_zram01.YG3YHQhMER/zram7: unknown filesystem type 'ntfs3'.
dmesg(1) may have more information after failed mount system call.
zram01 6 TBROK: mount /dev/zram7 zram7 failed

Quoted 2 lines

Fix by specifying -t option with the filesystem type that LTP verified as supported, avoiding auto-detection.

I guess there is nothing to be fixed in our lib/tst_supported_fs_types.c (or even testcases/lib/tst_supported_fs.c which uses it) and there is no other test using TST_ALL_FILESYSTEMS=1 which would need it.

Thanks for fixing this!

Kind regards,
Petr

Quoted 29 lines
---
 testcases/kernel/device-drivers/zram/zram01.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
testcases/kernel/device-drivers/zram/zram01.sh +6 -4
index 793f6603c..4b7f2a753 100755
@@ -94,13 +94,15 @@ zram_makefs()
 
 zram_mount()
 {
-	local i
+	local i=$dev_start
+	local fs
 
-	for i in $(seq $dev_start $dev_end); do
-		tst_res TINFO "mount /dev/zram$i"
+	for fs in $zram_filesystems; do
+		tst_res TINFO "mount /dev/zram$i ($fs)"
 		mkdir zram$i
-		ROD mount /dev/zram$i zram$i
+		ROD mount -t "$fs" /dev/zram$i zram$i
 		dev_mounted=$i
+		i=$((i + 1))
 	done
 
 	tst_res TPASS "mount of zram device(s) succeeded"
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi all,

thanks, merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp