On Mon, Oct 12, 2009 at 3:24 PM, Vladimir Dronnikov <[email protected]>wrote:
> >
> > Looking at strace it seems that mount first attempts the mount() syscall,
> if
> > that fails then it iterates /proc/filesystems and attempts to exec
> > mount.<fstype>.
> >
> > However, if the device is already mounted, mount() fails not because the
> > kernel doesn't grok the fs-type, but because the device is in use. In
> that
> > case, we should probably fail and report the mount() syscall error
> > immediately, instead of pointlessly iterating /proc/filesystems looking
> for
> > helper apps.
> >
> > Am I missing something else?
> >
>
> AFAIKS, iterations are only made if mount doesn't know fstype, either
> from -t option, or from /etc/fstab database.
> Can you put your testcase here?
>
Here's the first mount (note that ext2 is in the kernel)
~ # strace -f mount -t ext2 /dev/xsa2 /mnt
execve("/bin/mount", ["mount", "-t", "ext2", "/dev/xsa2", "/mnt"], [/* 7
vars */]) = 0
brk(0) = 0x10134000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/libm.so.6", O_RDONLY) = 3
read(3,
"\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\272\253\0\0\0\1\0\0Wx\0\0\0004"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=867636, ...}) = 0
mmap2(NULL, 868656, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x4801e000
mmap2(0x480f1000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd2) = 0x480f1000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3,
"\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\272\253\0\0\0\1\0\1\312P\0\0\0004"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1483440, ...}) = 0
mmap2(NULL, 1488016, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x480f3000
mmap2(0x48257000, 20480, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x164) = 0x48257000
mmap2(0x4825c000, 9360, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4825c000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x4825f000
mprotect(0x48257000, 12288, PROT_READ) = 0
getpid() = 68
getuid32() = 0
brk(0) = 0x10134000
brk(0x10155000) = 0x10155000
getuid32() = 0
geteuid32() = 0
stat64("/dev/xsa2", {st_mode=S_IFBLK|0755, st_rdev=makedev(254, 2), ...}) =
0
mount("/dev/xsa2", "/mnt", "ext2", MS_SILENT, ""EXT2-fs warning: mounting
unchecked fs, running e2fsck is recommended
) = 0
open("/etc/mtab", O_RDWR|O_CREAT|O_APPEND, 0666) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=51, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x48260000
fstat64(3, {st_mode=S_IFREG|0644, st_size=51, ...}) = 0
_llseek(3, 0, [0], SEEK_SET) = 0
read(3, "none /etc/config ramfs 0 0 0\nnon"..., 51) = 51
write(3, "/dev/xsa2 /mnt ext2 0 0\n", 25) = 25
close(3) = 0
munmap(0x48260000, 4096) = 0
exit_group(0) = ?
All good - mount() syscall succeeded.
Now, try again
~ # strace -f mount -t ext2 /dev/xsa2 /mnt
execve("/bin/mount", ["mount", "-t", "ext2", "/dev/xsa2", "/mnt"], [/* 7
vars */]) = 0
brk(0) = 0x10134000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/libm.so.6", O_RDONLY) = 3
read(3,
"\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\272\253\0\0\0\1\0\0Wx\0\0\0004"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=867636, ...}) = 0
mmap2(NULL, 868656, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x4801e000
mmap2(0x480f1000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd2) = 0x480f1000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3,
"\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\272\253\0\0\0\1\0\1\312P\0\0\0004"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1483440, ...}) = 0
mmap2(NULL, 1488016, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x480f3000
mmap2(0x48257000, 20480, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x164) = 0x48257000
mmap2(0x4825c000, 9360, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4825c000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x4825f000
mprotect(0x48257000, 12288, PROT_READ) = 0
getpid() = 70
getuid32() = 0
brk(0) = 0x10134000
brk(0x10155000) = 0x10155000
getuid32() = 0
geteuid32() = 0
stat64("/dev/xsa2", {st_mode=S_IFBLK|0755, st_rdev=makedev(254, 2), ...}) =
0
mount("/dev/xsa2", "/mnt", "ext2", MS_SILENT, "") = -1 EBUSY (Device or
resource busy)
<<<<<<<<<<<<<
mount() returned -EBUSY - we should give up now surely?
>>>>>>>>>>>>>
fork(Process 71 attached
) = 71
[pid 71] execve("/sbin/mount.ext2", ["mount.ext2", "/dev/xsa2", "/mnt",
"-o", ""], [/* 7 vars */]) = -1 ENOENT (No such file or directory)
[pid 71] execve("/usr/sbin/mount.ext2", ["mount.ext2", "/dev/xsa2",
"/mnt", "-o", ""], [/* 7 vars */]) = -1 ENOENT (No such file or directory)
[pid 71] execve("/bin/mount.ext2", ["mount.ext2", "/dev/xsa2", "/mnt",
"-o", ""], [/* 7 vars */]) = -1 ENOENT (No such file or directory)
[pid 71] execve("/usr/bin/mount.ext2", ["mount.ext2", "/dev/xsa2",
"/mnt", "-o", ""], [/* 7 vars */]) = -1 ENOENT (No such file or directory)
[pid 71] exit_group(111) = ?
Process 71 detached
waitpid(71, [{WIFEXITED(s) && WEXITSTATUS(s) == 111}], 0) = 71
--- SIGCHLD (Child exited) @ 0 (0) ---
exit_group(111) = ?
~ #
oops, we are iterating the known filesystems looking for helpers.
Thanks,
John
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox