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.
>From e77037699f8df4aa6cf149ef0a49cad0508c14bb Mon Sep 17 00:00:00 2001
From: Javier Viguera <[email protected]>
Date: Mon, 9 Jan 2012 10:57:11 +0100
Subject: [PATCH] find_mount_point: fix find_mount_point for char devices
This allows to find mount points of 'char' devices such as UBI volumes
which otherwise fail for example with 'df' command:
/ # 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
/ # df /dev/ubi0_0
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 115236 4 115232 0% /dev
Signed-off-by: Javier Viguera <[email protected]>
---
libbb/find_mount_point.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c
index 56637ad..79cd9f8 100644
--- a/libbb/find_mount_point.c
+++ b/libbb/find_mount_point.c
@@ -30,7 +30,7 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too)
devno_of_name = s.st_dev;
block_dev = 0;
- if (S_ISBLK(s.st_mode)) {
+ if (S_ISBLK(s.st_mode) || S_ISCHR(s.st_mode)) {
devno_of_name = s.st_rdev;
block_dev = 1;
}
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox