Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umount failed when format without partition #26

Closed
gongzhifeng opened this issue Feb 2, 2016 · 11 comments
Closed

umount failed when format without partition #26

gongzhifeng opened this issue Feb 2, 2016 · 11 comments

Comments

@gongzhifeng
Copy link

I'm using exfat 1.2.3 on soc board with microSD card.
Format card with command "mkfs.exfat /dev/mmcblk0", and the mount point is "/sdcard",
"umount /sdcard" will block. I try to trace the reason, it's blocked in system call "umount", and trace into kernel space, it's blocked in "fs/fuse/dev.c" wait_event_interruptible function.
But format with "mkfs.exfat /dev/mmcblk0p1", then "umount /sdcard" is ok.
So, is this a bug, which can't handle mmcblk0 umount?

@relan
Copy link
Owner

relan commented Feb 2, 2016

fuse-exfat should work with any block device. It makes no difference between a whole device and a partition. Try to attach to the mount.exfat-fuse process to see where it hangs. BTW which kernel and libc versions are used on this board?

@gongzhifeng
Copy link
Author

kernel 3.10.73+
libc 2.19-2014.08
gcc version 4.9.2 20140904
When umount hang, the mount.exfat-fuse process is still alive. Coud you tell me how to attach the mount.exfat-fuse process?
And there's no such issue when using "mkfs.vfat /dev/mmcblk0".
Coud you reproduce the issue?

@relan
Copy link
Owner

relan commented Feb 2, 2016

Coud you tell me how to attach the mount.exfat-fuse process?

gdb -p PID

@gongzhifeng
Copy link
Author

I tried, but there's no detail information.
gdb attach in a console, umount in another console:

ps x

338 ? Ss 0:00 mount.exfat /dev/mmcblk0 /sdcard -o errors=remount-ro

gdb -p 338

GNU gdb (crosstool-NG - Linaro Multilib GCC [CortexA9 & ARMv6k] 2014.09) 7.8-2014.09
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://bugs.launchpad.net/gcc-linaro.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 339
Reading symbols from /usr/sbin/mount.exfat-fuse...done.
Reading symbols from /usr/lib/libfuse.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libfuse.so.2
Reading symbols from /lib/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux-armhf.so.3...done.
Loaded symbols for /lib/ld-linux-armhf.so.3
0x76ea3004 in read () at ../sysdeps/unix/syscall-template.S:81
81 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) c
Continuing.

@gongzhifeng
Copy link
Author

Maybe it hung into libfuse, but libfuse is stripped, no more debug info.
Reading symbols from /usr/lib/libfuse.so.2...(no debugging symbols found)...done.
Using "strace umount /sdcard", the log show hung "umount(...)" system_call.

@relan
Copy link
Owner

relan commented Feb 2, 2016

I can't debug this issue for you. I can only give some advice:

  1. Get the stack trace of mount.exfat while it hangs.
  2. Look for I/O errors in the kernel log. They may be the reason of problems.

@gongzhifeng
Copy link
Author

I try to get the stack trace of mount.exfat, but when "umount" cmd hangs, the gdb also hangs, "Ctrl+C" still can't get interrupt signal, so can't get backtrace.
Maybe it is kernel hang partially, so I trace the kernel, it is blocked in

version linux-3.10
file: kernel/linux/fs/fuse/dev.c
function: wait_answer_interruptible
blocked line: wait_event_interruptible

but no I/O errors in kernel at all.
If this is not exfat bug, where can I report or get help?
Thank you very much!

@relan
Copy link
Owner

relan commented Feb 18, 2016

It's very strange that thread hangs in wait_answer_interruptible. Looks like a deadlock. Try to contact board's vendor.

BTW you can run mount.exfat-fuse under strace to see the last syscall before the hang.

Does unmounting of other FUSE-based filesystems (like ntfs-3g) work?

@gongzhifeng
Copy link
Author

BTW you can run mount.exfat-fuse under strace to see the last syscall before the hang.

when insert sdcard, mount.exfat-fuse process will auto run, and fork child process.
So I run strace -p $PID -f, the last syscall is close before the hang. the log is
# strace -p 384 -f
Process 384 attached
read(4, "8\0\0\0\3\0\0\0\2\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 135168) = 56
writev(4, [{"x\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0", 16},{"\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\200\0\0\0\0\0\0"..., 104}], 2) = 120
read(4, "0\0\0\0\2\0\0\0\3\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 135168) = 48
read(4, "(\0\0\0&\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 135168) = 40
pwrite(3, "\353v\220EXFAT \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512, 0) = 512
fsync(3) = 0
close(3

Does this hang happen only with fuse-exfat? Does unmounting of native filesystems (like ext4 or f2fs) work? Do other FUSE-based filesystems (like ntfs-3g) work?

I didn't try ext4 or f2fs because of tools not ready, but try vfat on board, umount is ok.
And the fuse-exfat umount is ok on PC Ubuntu 14.04.4 LTS.

@gongzhifeng gongzhifeng changed the title umount failed umount failed when format without partition Feb 19, 2016
@relan
Copy link
Owner

relan commented Feb 19, 2016

From this strace output we can see that mount.exfat-fuse hangs on closing /dev/mmcblk0. Source code is

void exfat_unmount(struct exfat* ef)
{
    ...
    finalize_super_block(ef);    <<< pwrite and fsync
    exfat_close(ef->dev);        <<< close
    ...
}

I'd say it's a kernel bug given that mount.exfat-fuse does not hang when it closes /dev/mmcblk0p1. For mount.exfat-fuse there is absolutely no difference between a partition and a whole device, in both cases it works in exactly the same way.

@relan
Copy link
Owner

relan commented Sep 13, 2016

No replies in 7 months, closing. Feel free to reopen if you have any new info.

@relan relan closed this as completed Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants