[PATCH] find mount point of char devices

Javier Viguera javier.viguera at digi.com
Mon Jan 9 10:10:14 UTC 2012


Hi all,

I found a corner case in 'df' command when using it with an UBIFS partition.

If i use 'df' without arguments, i got the correct values:

/ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root             72091984  12360980  56068924  18% /
devtmpfs                115236         4    115232   0% /dev
tmpfs                    28672        32     28640   0% /tmp
/dev/ubi0_0             360268     18348    341920   5% /tmp/mnt/userfs

while if i just pass the ubi volume i got the wrong answer:

/ # df /dev/ubi0_0
Filesystem           1K-blocks      Used Available Use% Mounted on
devtmpfs                115236         4    115232   0% /dev


Coreutils 'df' seems to work properly:

/ # /df --version
df (GNU coreutils) 8.15
...

/ # /df /dev/ubi0_0
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/ubi0_0       360268 18348    341920   6% /tmp/mnt/userfs

I tracked down the problem in busybox to the 'find_mount_point' function 
where it checks if the device to find the mountpoint is a block device 
or not. On UBI systems the volume to mount is a 'char' device:

/ # ls -l /dev/ubi0_0
crw-rw----    1 root     root      249,   1 Jan  4 21:42 /dev/ubi0_0

A basic patch that fixes the problem is attached (against current 
master), but I'm not sure if this is the correct fix or not, so i just 
send it here to review and consider applying.

-- 
Javier Viguera
Software Engineer
Digi International® Spain S.A.U.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-find_mount_point-fix-find_mount_point-for-char-devic.patch
Type: text/x-diff
Size: 1404 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20120109/76ddceb6/attachment.bin>


More information about the busybox mailing list