[Bug 264166] mount_msdosfs refuses to mount glabel label.

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 23 May 2022 01:36:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264166

            Bug ID: 264166
           Summary: mount_msdosfs refuses to mount glabel label.
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: t_uemura@macome.co.jp

There is a regression caused by the commit
c5c1537dc7ffd27066d035b8e236d3dcb548a3c8; msdosfs: sanity check sector count
from BPB, by Mr. Konstantin Belousov, which made mount_msdosfs to not accept
glabel label, even though the bare device node (such as da0s1) of the same disk
can be mounted and accessed correctly.

With the mentioned commit applied, as shown below, label couldn't be mounted
though the corresponding raw device da0s1 was handled as expected.

root@da320:~# glabel status | grep label/
                       label/MACOME_CONFIG     N/A  da0s1
root@da320:~# ls -la /dev/label/MACOME_CONFIG
crw-r-----  1 root  operator  0x73 May 22 20:54 /dev/label/MACOME_CONFIG
root@da320:~# gpart show da0
=>     63  3919809  da0  MBR  (1.9G)
       63  3919809    1  fat32lba  (1.9G)
root@da320:~# mount -rt msdosfs /dev/da0s1 /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt
root@da320:~# mount -rt msdosfs /dev/label/MACOME_CONFIG /mnt
mount_msdosfs: /dev/label/MACOME_CONFIG: Invalid argument
root@da320:~# echo $?
1

Backed out the commit, and the issue was fixed.

root@da320:~# mount -rt msdosfs /dev/da0s1 /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt
root@da320:~# mount -rt msdosfs /dev/label/MACOME_CONFIG /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt

With another USB stick (with the same label), the same problem happened if the
commit was applied.

root@da320:~# glabel status | grep label/
                       label/MACOME_CONFIG     N/A  da0
root@da320:~# ls -la /dev/label/MACOME_CONFIG
crw-r-----  1 root  operator  0x7b May 23 09:56 /dev/label/MACOME_CONFIG
root@da320:~# gpart show da0
gpart: No such geom: da0.
root@da320:~# mount -rt msdosfs /dev/da0 /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt
root@da320:~# mount -rt msdosfs /dev/label/MACOME_CONFIG /mnt
mount_msdosfs: /dev/label/MACOME_CONFIG: Invalid argument
root@da320:~# echo $?
1

And fixed when backed out.

root@da320:~# mount -rt msdosfs /dev/da0s1 /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt
root@da320:~# mount -rt msdosfs /dev/label/MACOME_CONFIG /mnt
root@da320:~# echo $?
0
root@da320:~# umount /mnt

-- 
You are receiving this mail because:
You are the assignee for the bug.