mount(8) unable to mount a device via symlink that contains ':'

Misha Gusarov misha at ridge.co
Thu Dec 3 14:36:22 UTC 2020


On 2 Dec 2020, at 17:26, Denys Vlasenko wrote:

>> $ mount -o bind /dev/disk/by-path/pci-0000:13:00.0-scsi-0:0:3:0
>> /some/mount/point
>> mount: bad address '/dev/disk/by-path/pci-0000'
>> $
>>
>> The problem stems from the following check in mount.c:
>>
>> // Might this be an NFS filesystem?
>> if ((!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs"))
>>   && strchr(mp->mnt_fsname, ':') != NULL
>> ) {
>
> Does this help?
>
>         // Might this be an NFS filesystem?
>         if ((!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs"))
>          && strchr(mp->mnt_fsname, ':') != NULL
> +        && !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))
>         ) {
>                 if (!mp->mnt_type)
>                         mp->mnt_type = (char*)"nfs";

Sure this helps in this particular scenario — however for non-bind NFS
detection should probably see that the part before `:` is a valid DNS name
or IP address. A simple check for lack of `/` before `:` should suffice.

-- 
Misha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20201203/77f581b6/attachment.html>


More information about the busybox mailing list