android-file-transfer-linux icon indicating copy to clipboard operation
android-file-transfer-linux copied to clipboard

aft-fuse-mount reacts badly to surprise device ejection

Open vi opened this issue 9 years ago • 2 comments

$ fuse/aft-mtp-mount m -o debug
Device is already used by another process
Device is already used by another process
0:0 index 0, eps 3
80 06 0300 0000
languages[4]:
00000000: 04 03 09 04 
descriptor[80]:
00000000: 12 01 00 02 00 00 00 40 d1 12 52 10 99 02 02 03 
00000010: 04 01 09 02 3e 00 02 01 00 c0 fa 09 04 00 00 03 
00000020: ff ff 00 05 07 05 81 02 00 02 00 07 05 01 02 00 
00000030: 02 00 07 05 82 03 1c 00 06 09 04 01 00 02 ff 42 
00000040: 01 00 07 05 83 02 00 02 00 07 05 02 02 00 02 00 
80 06 0305 0409
interface name[8]:
00000000: 08 03 4d 00 54 00 50 00 
FUSE library version: 2.9.0
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.23
...
read[0] 131072 bytes from 42598400 flags: 0x8000
   read[0] 131072 bytes from 42467328
   unique: 360, success, outsize: 131088
unique: 362, opcode: READ (15), nodeid: 4, insize: 80, pid: 13394
read[0] 131072 bytes from 42729472 flags: 0x8000
Device is already used by another process
Device is already used by another process
terminate called after throwing an instance of 'std::runtime_error'
  what():  no MTP device found
Aborted

Version is 84c200863ea9be3879eecba334a0e07553eb428b

vi avatar Oct 22 '15 14:10 vi

Backtrace:

(gdb) thread apply all bt full

Thread 4 (Thread 0xf68ffb40 (LWP 21704)):
#0  0xf7f375f1 in read () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1  0xf7f55c27 in read (__nbytes=135168, __buf=0xf7419008, __fd=<optimized out>) at /usr/include/i386-linux-gnu/bits/unistd.h:44
No locals.
#2  fuse_kern_chan_receive (chp=0xf68ff320, buf=0xf7419008 "P", size=135168) at fuse_kern_chan.c:28
        ch = 0x8118e10
        err = <optimized out>
        se = 0x81178f8
        __PRETTY_FUNCTION__ = "fuse_kern_chan_receive"
#3  0xf7f5d51e in fuse_chan_recv (chp=0xf68ff320, buf=0xf7419008 "P", size=135168) at fuse_session.c:214
        ch = <optimized out>
#4  0xf7f56e64 in fuse_ll_receive_buf (se=0x81178f8, buf=0xf68ff324, chp=0xf68ff320) at fuse_lowlevel.c:2668
        f = 0xfffffe00
        bufsize = 4148269064
        llp = 0x21000
#5  0xf7f5d56a in fuse_session_receive_buf (se=0x81178f8, buf=0xf68ff324, chp=0xf68ff320) at fuse_session.c:100
        res = <optimized out>
#6  0xf7f5624d in fuse_do_work (data=0xf6900750) at fuse_loop_mt.c:81
        ch = 0x8118e10
        fbuf = {size = 135168, flags = (unknown: 0), mem = 0xf7419008, fd = 0, pos = 0}
        res = -146698232
        mt = 0xffffda24
#7  0xf7f30d97 in start_thread (arg=0xf68ffb40) at pthread_create.c:309
        __res = <optimized out>
        pd = 0xf68ffb40
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-134995968, -158336192, 4001536, -158338008, 1520594808, -1554102406}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#8  0xf7d38dfe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
No locals.

Thread 3 (Thread 0xf72ffb40 (LWP 21673)):
#0  0xf7c91ddc in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = <optimized out>
        resultvar = <optimized out>
        pid = -136507392
        selftid = 21673
#1  0xf7c93463 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0xf7ffd000, sa_sigaction = 0xf7ffd000}, sa_mask = {__val = {4158462272, 4157419680, 4158462272, 4160737280, 4159868928, 5, 4147113664, 4160662687, 4159869368, 4156941728, 1, 5, 0, 4157421989, 4158462272, 10, 4147113636, 4159836188, 4158961848, 4158900984, 4158462272, 4157400572, 4158462272, 4156989716, 4136803604, 135318220, 4147113752, 4159836160, 4136803604, 135318220, 4147113752, 4160688160}}, sa_flags = -158159152, sa_restorer = 0xf7c93320 <__GI_abort>}
        sigs = {__val = {32, 0 <repeats 31 times>}}
#2  0xf7e83a25 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
No symbol table info available.
#3  0xf7e81733 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
No symbol table info available.
#4  0xf7e817ad in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
No symbol table info available.
#5  0xf7e81a70 in __cxa_throw () from /usr/lib/i386-linux-gnu/libstdc++.so.6
No symbol table info available.
#6  0x080bb2e8 in (anonymous namespace)::FuseWrapper::Connect (this=0x810d008) at fuse.cpp:71
        l = {_M_device = 0x810d008, _M_owns = true}
        ids = {StorageIDs = std::vector of length 1002948915, capacity -79999 = {135319560, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...}}
#7  0x080bdb58 in (anonymous namespace)::Read (path=0xf6900578 "/Internal storage/Music/q.tta", buf=0xf6900a80 "\r\022\r\216\335\ak+K4\273皉\240\031\232Z\335-v\a\217", size=131072, offset=37486592, fi=0xf72ff19c) at fuse.cpp:509
No locals.
#8  0xf7f4fe85 in fuse_fs_read_buf (fs=0x81190f0, path=0xf6900578 "/Internal storage/Music/q.tta", bufp=0xf72ff0fc, size=131072, off=37486592, fi=0xf72ff19c) at fuse.c:1829
        buf = <optimized out>
        mem = <optimized out>
        res = <optimized out>
#9  0xf7f5007e in fuse_lib_read (req=0xf6900468, ino=4, size=131072, off=37486592, fi=0xf72ff19c) at fuse.c:3287
        d = {id = 0, cond = {__data = {__lock = 135368704, __futex = 4136631200, __total_seq = 18446743914629038080, __wakeup_seq = 12888043820, __woken_seq = 17766700804862902272, __mutex = 0x58, __nwaiters = 4136632640, __broadcast_seq = 33}, __size = "\000\220\021\b\240\373\217\366\000\000\020\366\332\377\377\377,\361/\000\003\000\000\000\000\000\200\000@\000\220\366X\000\000\000@\001\220\366!\000\000\000\r'\000", __align = -680048353960947712}, finished = 84}
        f = 0x8119000
        buf = 0xf6900680
        path = 0xf6900578 "/Internal storage/Music/q.tta"
        res = <optimized out>
#10 0xf7f592b4 in do_read (req=0xf6900468, nodeid=4, inarg=0xf7f91030) at fuse_lowlevel.c:1232
        fi = {flags = 32768, fh_old = 0, writepage = 0, direct_io = 0, keep_cache = 0, flush = 0, nonseekable = 0, flock_release = 0, padding = 0, fh = 0, lock_owner = 0}
        arg = 0xf7f91030
#11 0xf7f59c54 in fuse_ll_process_buf (data=0x81193f8, buf=0xf72ff324, ch=0x8118e10) at fuse_lowlevel.c:2441
        bufv = {count = 1, idx = 0, off = 0, buf = {{size = 80, flags = (unknown: 0), mem = 0xf7f91008, fd = 0, pos = 0}}}
        tmpbuf = {count = 1, idx = 0, off = 0, buf = {{size = 80, flags = (unknown: 0), mem = 0x0, fd = -1, pos = 0}}}
        err = 0
#12 0xf7f5d35b in fuse_session_process_buf (se=0x81178f8, buf=0xf72ff324, ch=0x8118e10) at fuse_session.c:87
        __PRETTY_FUNCTION__ = "fuse_session_process_buf"
#13 0xf7f562c3 in fuse_do_work (data=0xf7300468) at fuse_loop_mt.c:117
        ch = 0x8118e10
        fbuf = {size = 80, flags = (unknown: 0), mem = 0xf7f91008, fd = 0, pos = 0}
        res = 21673
        mt = 0xffffda24
#14 0xf7f30d97 in start_thread (arg=0xf72ffb40) at pthread_create.c:309
        __res = <optimized out>
        pd = 0xf72ffb40
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-134995968, -147850432, 4001536, -147852248, 446852987, -1554102406}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#15 0xf7d38dfe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
No locals.

Thread 2 (Thread 0xf7c5bb40 (LWP 21668)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i586/../i486/lowlevellock.S:146
No locals.
#1  0xf7f33009 in _L_lock_842 () from /lib/i386-linux-gnu/libpthread.so.0
No symbol table info available.
#2  0xf7f32e40 in __GI___pthread_mutex_lock (mutex=0x810d008) at ../nptl/pthread_mutex_lock.c:79
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = 0
        id = <optimized out>
#3  0x080bafc6 in __gthread_mutex_lock (__mutex=0x810d008) at /usr/include/i386-linux-gnu/c++/4.9/bits/gthr-default.h:748
No locals.
#4  0x080bea88 in std::mutex::lock (this=0x810d008) at /usr/include/c++/4.9/mutex:135
        __e = 0
#5  0x080c0504 in std::unique_lock<std::mutex>::lock (this=0xf7c5aff8) at /usr/include/c++/4.9/mutex:474
No locals.
#6  0x080bf560 in std::unique_lock<std::mutex>::unique_lock (this=0xf7c5aff8, __m=...) at /usr/include/c++/4.9/mutex:406
No locals.
#7  0x080bb1c7 in (anonymous namespace)::FuseWrapper::Connect (this=0x810d008) at fuse.cpp:62
        l = {_M_device = 0x810d008, _M_owns = false}
        ids = {StorageIDs = std::vector of length 1005402419, capacity -79999 = {135319560, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...}}
#8  0x080bdb58 in (anonymous namespace)::Read (path=0xf7300598 "/Internal storage/Music/q.tta", buf=0xf7303b28 "rv\200H\003)\207΄\236[\361 \300\032\356\206\026\275a\027\334\322\300\347\034\200", <incomplete sequence \305>, size=131072, offset=37355520, fi=0xf7c5b19c) at fuse.cpp:509
No locals.
#9  0xf7f4fe85 in fuse_fs_read_buf (fs=0x81190f0, path=0xf7300598 "/Internal storage/Music/q.tta", bufp=0xf7c5b0fc, size=131072, off=37355520, fi=0xf7c5b19c) at fuse.c:1829
        buf = <optimized out>
        mem = <optimized out>
        res = <optimized out>
#10 0xf7f5007e in fuse_lib_read (req=0xf7300520, ino=4, size=131072, off=37355520, fi=0xf7c5b19c) at fuse.c:3287
        d = {id = 0, cond = {__data = {__lock = 135370244, __futex = 4160060442, __total_seq = 17866722321071341568, __wakeup_seq = 175955620152, __woken_seq = 17811736801128218624, __mutex = 0x58, __nwaiters = 4147118400, __broadcast_seq = 33}, __size = "\004\226\021\b\032|\365\367\000\000\000\000JY\363\367\070\261\305\367(\000\000\000\000\000\000\000@\000\060\367X\000\000\000@\001\060\367!\000\000\000\f'\000", __align = -579420525800876540}, finished = 84}
        f = 0x8119000
        buf = 0xf73006a0
        path = 0xf7300598 "/Internal storage/Music/q.tta"
        res = <optimized out>
#11 0xf7f592b4 in do_read (req=0xf7300520, nodeid=4, inarg=0xf7fb3030) at fuse_lowlevel.c:1232
        fi = {flags = 32768, fh_old = 0, writepage = 0, direct_io = 0, keep_cache = 0, flush = 0, nonseekable = 0, flock_release = 0, padding = 0, fh = 0, lock_owner = 0}
        arg = 0xf7fb3030
#12 0xf7f59c54 in fuse_ll_process_buf (data=0x81193f8, buf=0xf7c5b324, ch=0x8118e10) at fuse_lowlevel.c:2441
        bufv = {count = 1, idx = 0, off = 0, buf = {{size = 80, flags = (unknown: 0), mem = 0xf7fb3008, fd = 0, pos = 0}}}
        tmpbuf = {count = 1, idx = 0, off = 0, buf = {{size = 80, flags = (unknown: 0), mem = 0x0, fd = -1, pos = 0}}}
        err = -512
#13 0xf7f5d35b in fuse_session_process_buf (se=0x81178f8, buf=0xf7c5b324, ch=0x8118e10) at fuse_session.c:87
        __PRETTY_FUNCTION__ = "fuse_session_process_buf"
#14 0xf7f562c3 in fuse_do_work (data=0x8118de0) at fuse_loop_mt.c:117
        ch = 0x8118e10
        fbuf = {size = 80, flags = (unknown: 0), mem = 0xf7fb3008, fd = 0, pos = 0}
        res = 128
        mt = 0xffffda24
#15 0xf7f30d97 in start_thread (arg=0xf7c5bb40) at pthread_create.c:309
        __res = <optimized out>
        pd = 0xf7c5bb40
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-134995968, -138036416, 4001536, -138038232, -836604038, -1554102406}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#16 0xf7d38dfe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
No locals.

Thread 1 (Thread 0xf7c5d700 (LWP 21664)):
#0  sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i586/../i486/sem_wait.S:80
No locals.
#1  0xf7f564c9 in fuse_session_loop_mt (se=0x81178f8) at fuse_loop_mt.c:242
        err = -9628
        mt = {lock = {__data = {__lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {d = {__espins = 0, __elision = 0}, __list = {__next = 0x0}}}, __size = '\000' <repeats 23 times>, __align = 0}, numworker = 3, numavail = 1, se = 0x81178f8, prevch = 0x8118e10, main = {prev = 0xf6900750, next = 0x8118de0, thread_id = 4156937984, bufsize = 0, buf = 0x0, mt = 0x0}, finish = {__size = "\000\000\000\000\200\000\000\000\001\000\000\000\000\000\000", __align = 0}, exit = 0, error = 0}
        w = 0xffffda64
#2  0xf7f5c3d7 in fuse_loop_mt (f=0x8119000) at fuse_mt.c:117
        res = <optimized out>
#3  0xf7f5f3c9 in fuse_main_common (argc=<optimized out>, argv=<optimized out>, op=0xffffdb1c, op_size=176, user_data=0x0, compat=0) at helper.c:355
        fuse = 0x8119000
        mountpoint = 0x8117920 "/root/m"
        multithreaded = 1
        res = <optimized out>
#4  0x080be6b3 in main (argc=4, argv=0xffffdc94) at fuse.cpp:565
        ops = {getattr = 0x80bd63f <(anonymous namespace)::GetAttr(char const*, stat*)>, readlink = 0x0, getdir = 0x0, mknod = 0x0, mkdir = 0x80bdf3d <(anonymous namespace)::MakeDir(char const*, mode_t)>, unlink = 0x80bde30 <(anonymous namespace)::Unlink(char const*)>, rmdir = 0x80be050 <(anonymous namespace)::RemoveDir(char const*)>, symlink = 0x0, rename = 0x0, link = 0x0, chmod = 0x80be4a2 <(anonymous namespace)::ChangeMode(char const*, mode_t)>, chown = 0x0, truncate = 0x80be15d <(anonymous namespace)::Truncate(char const*, off_t)>, utime = 0x0, open = 0x80bd889 <(anonymous namespace)::Open(char const*, fuse_file_info*)>, read = 0x80bdaaf <(anonymous namespace)::Read(char const*, char*, size_t, off_t, fuse_file_info*)>, write = 0x80bdbe6 <(anonymous namespace)::Write(char const*, char const*, size_t, off_t, fuse_file_info*)>, statfs = 0x80be27c <(anonymous namespace)::StatFS(char const*, statvfs*)>, flush = 0x80bdd1d <(anonymous namespace)::Flush(char const*, fuse_file_info*)>, release = 0x0, fsync = 0x0, setxattr = 0x0, getxattr = 0x0, listxattr = 0x0, removexattr = 0x0, opendir = 0x0, readdir = 0x80bd752 <(anonymous namespace)::ReadDir(char const*, void*, fuse_fill_dir_t, off_t, fuse_file_info*)>, releasedir = 0x0, fsyncdir = 0x0, init = 0x80bd618 <(anonymous namespace)::Init(fuse_conn_info*)>, destroy = 0x0, access = 0x0, create = 0x80bd99c <(anonymous namespace)::Create(char const*, mode_t, fuse_file_info*)>, ftruncate = 0x0, fgetattr = 0x0, lock = 0x0, utimens = 0x80be38f <(anonymous namespace)::SetTimes(char const*, timespec const*)>, bmap = 0x0, flag_nullpath_ok = 0, flag_nopath = 0, flag_utime_omit_ok = 0, flag_reserved = 0, ioctl = 0x0, poll = 0x0, write_buf = 0x0, read_buf = 0x0, flock = 0x0}

vi avatar Oct 22 '15 14:10 vi

Still issue with ll:

unique: 62, opcode: READ (15), nodeid: 1047181, insize: 80, pid: 28232
   Read 1047181 131072 7208960
   unique: 62, success, outsize: 131088
unique: 63, opcode: READ (15), nodeid: 1047181, insize: 80, pid: 28232
   Read 1047181 131072 7340032
capabilities = 0x0000001f
<zero> 
<bulk-continuation> 
<no-packet-size-limit> 
<bulk-scatter-gather> 
<reap-after-disconnect> 
Device::FindDevice is already used by another process
capabilities = 0x0000001f
<zero> 
<bulk-continuation> 
<no-packet-size-limit> 
<bulk-scatter-gather> 
<reap-after-disconnect> 
Device::FindDevice is already used by another process
terminate called after throwing an instance of 'std::runtime_error'
  what():  no MTP device found
Aborted

Ideally it should wait for device reconnection and resume transfer (if the object id corresponds to the same file path as before). Simpler alternative is to fail just this operation, invalidate opened files, clear cache and check for new connected device on FUSE requests.

vi avatar Nov 11 '15 16:11 vi