Guest User

Untitled

a guest
Nov 24th, 2008
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.63 KB | None | 0 0
  1. X-send-pr-version: 3.113
  2. X-GNATS-Notify:
  3.  
  4.  
  5. >Submitter-Id: current-users
  6. >Originator: <[email protected]>
  7. >Organization: n/a
  8. >Confidential: no
  9. >Synopsis: [zfs] panic on concurrent writing & rollback
  10. >Severity: non-critical
  11. >Priority: low
  12. >Category: kern
  13. >Class: sw-bug
  14. >Release: FreeBSD 8.0-CURRENT amd64
  15. >Environment:
  16. System: FreeBSD 8.0-CURRENT FreeBSD 8.0-CURRENT #2 r185244: Mon Nov 24 16:29:02 UTC 2008 luser@qemu:/usr/obj/usr/src/sys/TEST amd64
  17.  
  18. qemu-devel cmdline:
  19. qemu-system-x86_64 -no-kqemu -m 512 -net nic,model=rtl8139 \
  20. -net tap,ifname=tap0 -nographic -s -echr 0x03 scrap/freebsd-generic-amd64.qcow2
  21.  
  22. zpool upgrade shows version 13
  23. zfs upgrade shows version 3
  24.  
  25. The box boots from gptzfsboot. There are no UFS partitions on it.
  26.  
  27. kernel config:
  28. include GENERIC
  29. options BREAK_TO_DEBUGGER
  30. options DIAGNOSTIC
  31. options DEBUG_LOCKS
  32. options DEBUG_VFS_LOCKS
  33. nooption WITNESS_SKIPSPIN
  34.  
  35. loader.conf:
  36. autoboot_delay=0
  37. beastie_disable=YES
  38. zfs_load=YES
  39. vfs.root.mountfrom="zfs:q"
  40. kern.hz=100
  41. hint.uart.0.flags=0x90
  42.  
  43. no kmem_size and prefetch_disable tunings here.
  44.  
  45. boot.config: -h -S115200
  46.  
  47. entire system was built with __MAKE_CONF=/dev/null on host machine.
  48. No local patches applied on it.
  49.  
  50. The host is on 8-CURRENT r185232M amd64. `M' stands for slightly updated ZFS.
  51. It experiences similar problem along with another box on i386.
  52.  
  53. >Description:
  54.  
  55. When doing rollbacks on snapshot multiple times there is
  56. chance to encounter a panic.
  57. %%%
  58. # sh crash.sh
  59. lock order reversal:
  60. 1st 0xffffff0002888638 vnode interlock (vnode interlock) @ /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:3699
  61. 2nd 0xffffff0002429710 struct mount mtx (struct mount mtx) @ /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c:1050
  62. KDB: stack backtrace:
  63. db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
  64. _witness_debugger() at _witness_debugger+0x2e
  65. witness_checkorder() at witness_checkorder+0x81e
  66. _mtx_lock_flags() at _mtx_lock_flags+0x78
  67. zfs_znode_free() at zfs_znode_free+0x84
  68. zfs_freebsd_inactive() at zfs_freebsd_inactive+0x1a
  69. VOP_INACTIVE_APV() at VOP_INACTIVE_APV+0xb5
  70. vinactive() at vinactive+0x90
  71. vput() at vput+0x25c
  72. vn_close() at vn_close+0xb9
  73. vn_closefile() at vn_closefile+0x7d
  74. _fdrop() at _fdrop+0x23
  75. closef() at closef+0x4d
  76. do_dup() at do_dup+0x351
  77. syscall() at syscall+0x1e7
  78. Xfast_syscall() at Xfast_syscall+0xab
  79. --- syscall (90, FreeBSD ELF64, dup2), rip = 0x80093b08c, rsp = 0x7fffffffe328, rbp = 0x800b0d0a0 ---
  80. KDB: stack backtrace:
  81. db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
  82. vfs_badlock() at vfs_badlock+0x95
  83. VOP_INACTIVE_APV() at VOP_INACTIVE_APV+0xc8
  84. vinactive() at vinactive+0x90
  85. vput() at vput+0x25c
  86. vn_close() at vn_close+0xb9
  87. vn_closefile() at vn_closefile+0x7d
  88. _fdrop() at _fdrop+0x23
  89. closef() at closef+0x4d
  90. do_dup() at do_dup+0x351
  91. syscall() at syscall+0x1e7
  92. Xfast_syscall() at Xfast_syscall+0xab
  93. --- syscall (90, FreeBSD ELF64, dup2), rip = 0x80093b08c, rsp = 0x7fffffffe328, rbp = 0x800b0d0a0 ---
  94. VOP_INACTIVE: 0xffffff00028884e0 interlock is locked but should not be
  95. KDB: enter: lock violation
  96. [thread pid 85 tid 100056 ]
  97. Stopped at kdb_enter+0x3d: movq $0,0x65c598(%rip)
  98.  
  99. db> show all locks
  100. Process 85 (sh) thread 0xffffff0002427390 (100056)
  101. exclusive sleep mutex vnode interlock (vnode interlock) r = 0 (0xffffff0002888638) locked @ /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:3699
  102. exclusive lockmgr zfs (zfs) r = 0 (0xffffff0002888578) locked @ /usr/src/sys/kern/vfs_vnops.c:293
  103.  
  104. db> show lockedvnods
  105. Locked vnodes
  106.  
  107. 0xffffff00028884e0: tag zfs, type VREG
  108. usecount 0, writecount 0, refcount 1 mountedhere 0
  109. flags (VI_DOINGINACT)
  110. VI_LOCKed v_object 0xffffff0002886960 ref 0 pages 0
  111. lock type zfs: EXCL by thread 0xffffff0002427390 (pid 85)
  112. #0 0xffffffff804dfc78 at __lockmgr_args+0x758
  113. #1 0xffffffff8056de19 at vop_stdlock+0x39
  114. #2 0xffffffff8080d77b at VOP_LOCK1_APV+0x9b
  115. #3 0xffffffff805894a7 at _vn_lock+0x57
  116. #4 0xffffffff8058a58e at vn_close+0x6e
  117. #5 0xffffffff8058a6bd at vn_closefile+0x7d
  118. #6 0xffffffff804c7443 at _fdrop+0x23
  119. #7 0xffffffff804c8a6d at closef+0x4d
  120. #8 0xffffffff804c9ed1 at do_dup+0x351
  121. #9 0xffffffff807c9d27 at syscall+0x1e7
  122. #10 0xffffffff807ac85b at Xfast_syscall+0xab
  123.  
  124. db> show all pcpu
  125. Current CPU: 0
  126.  
  127. cpuid = 0
  128. curthread = 0xffffff0002427390: pid 85 "sh"
  129. curpcb = 0xfffffffe40180d50
  130. fpcurthread = none
  131. idlethread = 0xffffff00021cc720: pid 11 "idle: cpu0"
  132. spin locks held:
  133. %%%
  134.  
  135. Complete msgbuf with ps and alltrace is here:
  136. http://pastebin.com/f44ad88b3
  137.  
  138. It can occur with a slightly different message:
  139.  
  140. %%%
  141. # sh crash.sh
  142. Fatal trap 12: page fault while in kernel mode
  143. cpuid = 0; apic id = 00
  144. fault virtual address = 0x70
  145. fault code = supervisor read data, page not present
  146. instruction pointer = 0x8:0xffffffff804fb57a
  147. stack pointer = 0x10:0xfffffffe401997a0
  148. frame pointer = 0x10:0xfffffffe401997e0
  149. code segment = base 0x0, limit 0xfffff, type 0x1b
  150. = DPL 0, pres 1, long 1, def32 0, gran 1
  151. processor eflags = interrupt enabled, IOPL = 0
  152. current process = 179 (zfs)
  153. [thread pid 179 tid 100061 ]
  154. Stopped at _sx_xlock+0x3a: movq 0x18(%rdi),%rax
  155.  
  156. db> bt
  157. Tracing pid 179 tid 100061 td 0xffffff000245dab0
  158. _sx_xlock() at _sx_xlock+0x3a
  159. dmu_buf_update_user() at dmu_buf_update_user+0x47
  160. zfs_znode_dmu_fini() at zfs_znode_dmu_fini+0x38
  161. zfs_freebsd_reclaim() at zfs_freebsd_reclaim+0xbe
  162. VOP_RECLAIM_APV() at VOP_RECLAIM_APV+0xb5
  163. vgonel() at vgonel+0x119
  164. vflush() at vflush+0x284
  165. zfs_umount() at zfs_umount+0x105
  166. dounmount() at dounmount+0x2ed
  167. unmount() at unmount+0x24b
  168. syscall() at syscall+0x1e7
  169. Xfast_syscall() at Xfast_syscall+0xab
  170. --- syscall (22, FreeBSD ELF64, unmount), rip = 0x800f401cc, rsp = 0x7fffffffe478, rbp = 0x801202300 ---
  171.  
  172. db> show all locks
  173. Process 179 (zfs) thread 0xffffff000245dab0 (100061)
  174. exclusive lockmgr zfs (zfs) r = 0 (0xffffff0002693098) locked @ /usr/src/sys/kern/vfs_subr.c:2358
  175. exclusive sleep mutex Giant (Giant) r = 0 (0xffffffff80b5eea0) locked @ /usr/src/sys/kern/vfs_mount.c:1139
  176. exclusive lockmgr zfs (zfs) r = 0 (0xffffff0002693a58) locked @ /usr/src/sys/kern/vfs_mount.c:1207
  177.  
  178. db> show lockedvnods
  179. Locked vnodes
  180.  
  181. 0xffffff00026939c0: tag zfs, type VDIR
  182. usecount 1, writecount 0, refcount 1 mountedhere 0xffffff0002432710
  183. flags ()
  184. lock type zfs: EXCL by thread 0xffffff000245dab0 (pid 179)
  185. #0 0xffffffff804dfc78 at __lockmgr_args+0x758
  186. #1 0xffffffff8056de19 at vop_stdlock+0x39
  187. #2 0xffffffff8080d77b at VOP_LOCK1_APV+0x9b
  188. #3 0xffffffff805894a7 at _vn_lock+0x57
  189. #4 0xffffffff80577303 at dounmount+0x93
  190. #5 0xffffffff80577adb at unmount+0x24b
  191. #6 0xffffffff807c9d27 at syscall+0x1e7
  192. #7 0xffffffff807ac85b at Xfast_syscall+0xab
  193.  
  194.  
  195. 0xffffff0002693000: tag zfs, type VREG
  196. usecount 0, writecount 0, refcount 1 mountedhere 0
  197. flags (VI_DOOMED)
  198. lock type zfs: EXCL by thread 0xffffff000245dab0 (pid 179)
  199. #0 0xffffffff804dfc78 at __lockmgr_args+0x758
  200. #1 0xffffffff8056de19 at vop_stdlock+0x39
  201. #2 0xffffffff8080d77b at VOP_LOCK1_APV+0x9b
  202. #3 0xffffffff805894a7 at _vn_lock+0x57
  203. #4 0xffffffff8057fecf at vflush+0x20f
  204. #5 0xffffffff80f5f175 at zfs_umount+0x105
  205. #6 0xffffffff8057755d at dounmount+0x2ed
  206. #7 0xffffffff80577adb at unmount+0x24b
  207. #8 0xffffffff807c9d27 at syscall+0x1e7
  208. #9 0xffffffff807ac85b at Xfast_syscall+0xab
  209.  
  210. db> show all pcpu
  211. Current CPU: 0
  212.  
  213. cpuid = 0
  214. curthread = 0xffffff000245dab0: pid 179 "zfs"
  215. curpcb = 0xfffffffe40199d50
  216. fpcurthread = none
  217. idlethread = 0xffffff00021cc720: pid 11 "idle: cpu0"
  218. spin locks held:
  219. %%%
  220.  
  221. Again, full session with ps and alltrace include is here:
  222. http://pastebin.com/f21e46723
  223.  
  224. BTW, here is a backup of this message in case it's mangled:
  225. you're already looking at it ;)
  226.  
  227. >How-To-Repeat:
  228.  
  229. It's not very reliable but the following script triggers it very
  230. often. If the panic don't occur within a minute then there is a chance
  231. it will occur after you interrupt and restart the script.
  232.  
  233. %%%
  234. #! /bin/sh
  235. # crash.sh
  236.  
  237. PATH=/sbin:/bin
  238.  
  239. pool=q
  240. dataset=test
  241. snapshot=last
  242. prefix=foo_
  243. cycles=999999999
  244.  
  245. zfs destroy -r $pool/$dataset
  246. zfs create $pool/$dataset
  247. zfs snapshot $pool/$dataset@$snapshot
  248.  
  249. mountpoint=$(zfs get -Ho value mountpoint $pool/$dataset)
  250.  
  251. loop() {
  252. local i=0
  253. while [ $((i+=1)) -lt $cycles ]; do
  254. eval $@
  255. done &
  256. pids="$pids $!"
  257. }
  258. trap 'kill $pids' int term exit
  259.  
  260. # juggle these
  261. loop : \>$mountpoint/$prefix\${i}
  262. loop zfs rollback $pool/$dataset@$snapshot
  263.  
  264. wait
  265. %%%
  266.  
  267. >Fix:
  268.  
  269.  
Advertisement
Add Comment
Please, Sign In to add comment