openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.56k stars 1.74k forks source link

Netatalk and cp -ra Crash ZFS #202

Closed kkoning closed 13 years ago

kkoning commented 13 years ago
[  202.175452] ------------[ cut here ]------------
[  202.175456] kernel BUG at fs/dcache.c:1418!
[  202.175458] invalid opcode: 0000 [#1] SMP 
[  202.175461] last sysfs file: /sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/local_cpus
[  202.175463] CPU 12 
[  202.175465] Modules linked in: zfs(P) zcommon(P) znvpair(P) zavl(P) zunicode(P) spl zlib_deflate nvidia(P) coretemp f71882fg pata_jmicron ata_generic pata_acpi
[  202.175475] 
[  202.175478] Pid: 4983, comm: afpd Tainted: P            2.6.38.3 #4 To Be Filled By O.E.M. To Be Filled By O.E.M./EVGA Classified SR-2
[  202.175483] RIP: 0010:[]  [] d_instantiate+0x1d/0x5a
[  202.175491] RSP: 0018:ffff88031fab5718  EFLAGS: 00010283
[  202.175494] RAX: ffff88031fab5c98 RBX: ffff8803207c45b0 RCX: 0000000000000015
[  202.175496] RDX: 0000000000000000 RSI: ffff8803207c45b0 RDI: ffff88031fab5be8
[  202.175498] RBP: ffff88031fab5728 R08: 0000000000000000 R09: 00000000ffffff80
[  202.175500] R10: dead000000100100 R11: 0000000000000247 R12: ffff88031fab5be8
[  202.175502] R13: ffff88031d878000 R14: ffff88031cfa7540 R15: ffff8803325c0bf8
[  202.175505] FS:  00007f9378b4f700(0000) GS:ffff8800bf4c0000(0000) knlGS:0000000000000000
[  202.175508] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  202.175510] CR2: 000000000046ac21 CR3: 000000031fab1000 CR4: 00000000000006e0
[  202.175512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  202.175514] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  202.175517] Process afpd (pid: 4983, threadinfo ffff88031fab4000, task ffff88033271c7e0)
[  202.175518] Stack:
[  202.175520]  ffff8803207c45b0 ffff8803207c4438 ffff88031fab5908 ffffffffa0ad2553
[  202.175523]  ffff88031fab5748 ffffffff00000011 ffff880300000000 0000000000006001
[  202.175527]  ffff8803207c4558 0000000000000000 ffffc90000050008 ffffc900290c9248
[  202.175531] Call Trace:
[  202.175549]  [] zfs_znode_alloc+0x431/0x4a3 [zfs]
[  202.175562]  [] zfs_mknode+0xa60/0xb2a [zfs]
[  202.175578]  [] zfs_make_xattrdir+0x15f/0x22f [zfs]
[  202.175582]  [] ? __getblk+0x28/0x2d6
[  202.175597]  [] zfs_get_xattrdir+0x126/0x156 [zfs]
[  202.175600]  [] ? __d_rehash+0x1e/0x55
[  202.175604]  [] ? string+0x4c/0xaf
[  202.175608]  [] ? mutex_lock+0x11/0x38
[  202.175621]  [] zfs_lookup+0x173/0x2b6 [zfs]
[  202.175632]  [] zpl_xattr_set+0x6a/0x1f2 [zfs]
[  202.175637]  [] ? kmem_asprintf+0x4c/0x5a [spl]
[  202.175649]  [] zpl_xattr_user_set+0x6d/0x86 [zfs]
[  202.175653]  [] generic_setxattr+0x66/0x68
[  202.175655]  [] __vfs_setxattr_noperm+0x38/0xb5
[  202.175658]  [] vfs_setxattr+0x79/0x97
[  202.175661]  [] setxattr+0xb8/0xd6
[  202.175664]  [] ? user_path_at+0x66/0x95
[  202.175667]  [] ? mntput+0x21/0x23
[  202.175672]  [] ? commit_creds+0x163/0x16d
[  202.175674]  [] sys_setxattr+0x60/0x85
[  202.175679]  [] system_call_fastpath+0x16/0x1b
[  202.175681] Code: 38 00 00 5a 5b 41 5c 4c 89 e8 41 5d c9 c3 55 48 8d 87 b0 00 00 00 48 89 e5 41 54 49 89 fc 53 48 39 87 b0 00 00 00 48 89 f3 74 04 <0f> 0b eb fe 48 85 f6 74 09 48 8d 7e 20 e8 8f b5 47 00 48 89 de 
[  202.175708] RIP  [] d_instantiate+0x1d/0x5a
[  202.175712]  RSP 
[  202.175715] ---[ end trace bdc7524a10db807f ]---

The above trace happens whenever I connect from a client (when I am prompted for a username/password. Copying my old homedir to a zfs volume with cp -ra will also reliably cause what looks like a similar crash.

root@atlantis:/home# cp -ra kkoning.old /Arcturus/tmp/
Segmentation fault

root@atlantis:/home# dmesg | tail -55
[   36.135853] modprobe used greatest stack depth: 2176 bytes left
[   38.695325] eth0: no IPv6 routers present
[ 1301.492830] ------------[ cut here ]------------
[ 1301.492833] kernel BUG at fs/dcache.c:1418!
[ 1301.492835] invalid opcode: 0000 [#1] SMP 
[ 1301.492837] last sysfs file: /sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_map
[ 1301.492838] CPU 1 
[ 1301.492839] Modules linked in: zfs(P) zcommon(P) znvpair(P) zavl(P) zunicode(P) spl zlib_deflate nvidia(P) coretemp f71882fg pata_jmicron ata_generic pata_acpi
[ 1301.492847] 
[ 1301.492849] Pid: 5439, comm: cp Tainted: P            2.6.38.3 #4 To Be Filled By O.E.M. To Be Filled By O.E.M./EVGA Classified SR-2
[ 1301.492853] RIP: 0010:[]  [] d_instantiate+0x1d/0x5a
[ 1301.492860] RSP: 0018:ffff88061d559718  EFLAGS: 00010283
[ 1301.492862] RAX: ffff88061d559c98 RBX: ffff8802180dad60 RCX: 0000000000000015
[ 1301.492863] RDX: 0000000000000000 RSI: ffff8802180dad60 RDI: ffff88061d559be8
[ 1301.492865] RBP: ffff88061d559728 R08: 0000000000000000 R09: ffff8802180ac040
[ 1301.492866] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88061d559be8
[ 1301.492868] R13: ffff88061c24b000 R14: ffff88021807d000 R15: ffff8802180ac040
[ 1301.492870] FS:  00007ffe06dee7a0(0000) GS:ffff8800bf420000(0000) knlGS:0000000000000000
[ 1301.492871] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1301.492873] CR2: 0000000001148168 CR3: 00000006285cb000 CR4: 00000000000006e0
[ 1301.492874] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1301.492876] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1301.492878] Process cp (pid: 5439, threadinfo ffff88061d558000, task ffff880627948000)
[ 1301.492879] Stack:
[ 1301.492880]  ffff8802180dad60 ffff8802180dabe8 ffff88061d559908 ffffffffa0ad1553
[ 1301.492882]  ffff88061d559748 ffffffff00000011 ffff880600000000 0000000000109a13
[ 1301.492885]  ffff8802180dad08 0000000000000000 ffffc90100050008 ffffc90132fbe648
[ 1301.492888] Call Trace:
[ 1301.492908]  [] zfs_znode_alloc+0x431/0x4a3 [zfs]
[ 1301.492918]  [] zfs_mknode+0xa60/0xb2a [zfs]
[ 1301.492929]  [] zfs_make_xattrdir+0x15f/0x22f [zfs]
[ 1301.492940]  [] zfs_get_xattrdir+0x126/0x156 [zfs]
[ 1301.492943]  [] ? ext4_find_entry+0xb0/0x2f3
[ 1301.492946]  [] ? _raw_spin_lock+0x9/0xd
[ 1301.492949]  [] ? string+0x4c/0xaf
[ 1301.492951]  [] ? __d_rehash+0x1e/0x55
[ 1301.492954]  [] ? mutex_lock+0x11/0x38
[ 1301.492963]  [] zfs_lookup+0x173/0x2b6 [zfs]
[ 1301.492971]  [] zpl_xattr_set+0x6a/0x1f2 [zfs]
[ 1301.492975]  [] ? kmem_asprintf+0x4c/0x5a [spl]
[ 1301.492983]  [] zpl_xattr_user_set+0x6d/0x86 [zfs]
[ 1301.492986]  [] generic_setxattr+0x66/0x68
[ 1301.492988]  [] __vfs_setxattr_noperm+0x38/0xb5
[ 1301.492990]  [] vfs_setxattr+0x79/0x97
[ 1301.492992]  [] setxattr+0xb8/0xd6
[ 1301.492995]  [] ? ext4_xattr_list_entries+0x55/0x91
[ 1301.492997]  [] ? ext4_listxattr+0x189/0x1d3
[ 1301.493000]  [] ? alloc_fd+0x116/0x129
[ 1301.493003]  [] ? virt_to_head_page+0x9/0x2c
[ 1301.493005]  [] sys_fsetxattr+0x57/0x85
[ 1301.493009]  [] system_call_fastpath+0x16/0x1b
[ 1301.493011] Code: 38 00 00 5a 5b 41 5c 4c 89 e8 41 5d c9 c3 55 48 8d 87 b0 00 00 00 48 89 e5 41 54 49 89 fc 53 48 39 87 b0 00 00 00 48 89 f3 74 04 <0f> 0b eb fe 48 85 f6 74 09 48 8d 7e 20 e8 8f b5 47 00 48 89 de 
[ 1301.493030] RIP  [] d_instantiate+0x1d/0x5a
[ 1301.493033]  RSP 
[ 1301.493035] ---[ end trace 73165c82883900e4 ]---
root@atlantis:/home# 

Configuration information:


root@atlantis:/home# zpool get all Arcturus
NAME      PROPERTY       VALUE       SOURCE
Arcturus  size           16.2T       -
Arcturus  capacity       23%         -
Arcturus  altroot        -           default
Arcturus  health         ONLINE      -
Arcturus  guid           2194721189751589572  local
Arcturus  version        22          local
Arcturus  bootfs         -           default
Arcturus  delegation     on          default
Arcturus  autoreplace    off         default
Arcturus  cachefile      -           default
Arcturus  failmode       wait        default
Arcturus  listsnapshots  off         default
Arcturus  autoexpand     off         default
Arcturus  dedupditto     0           default
Arcturus  dedupratio     1.00x       -
Arcturus  free           12.5T       -
Arcturus  allocated      3.77T       -
Arcturus  readonly       off         -
root@atlantis:/home# zfs get all Arcturus
NAME      PROPERTY              VALUE                  SOURCE
Arcturus  type                  filesystem             -
Arcturus  creation              Fri Mar  4  3:24 2011  -
Arcturus  used                  2.48T                  -
Arcturus  available             8.05T                  -
Arcturus  referenced            1.29T                  -
Arcturus  compressratio         1.00x                  -
Arcturus  mounted               yes                    -
Arcturus  quota                 none                   default
Arcturus  reservation           none                   default
Arcturus  recordsize            128K                   default
Arcturus  mountpoint            /Arcturus              default
Arcturus  sharenfs              off                    default
Arcturus  checksum              on                     default
Arcturus  compression           off                    default
Arcturus  atime                 off                    local
Arcturus  devices               on                     default
Arcturus  exec                  on                     default
Arcturus  setuid                on                     default
Arcturus  readonly              off                    default
Arcturus  zoned                 off                    default
Arcturus  snapdir               hidden                 default
Arcturus  aclinherit            restricted             default
Arcturus  canmount              on                     default
Arcturus  xattr                 on                     local
Arcturus  copies                1                      default
Arcturus  version               4                      -
Arcturus  utf8only              off                    -
Arcturus  normalization         none                   -
Arcturus  casesensitivity       sensitive              -
Arcturus  vscan                 off                    default
Arcturus  nbmand                off                    default
Arcturus  sharesmb              off                    default
Arcturus  refquota              none                   default
Arcturus  refreservation        none                   default
Arcturus  primarycache          all                    default
Arcturus  secondarycache        metadata               local
Arcturus  usedbysnapshots       144G                   -
Arcturus  usedbydataset         1.29T                  -
Arcturus  usedbychildren        1.05T                  -
Arcturus  usedbyrefreservation  0                      -
Arcturus  logbias               latency                default
Arcturus  dedup                 off                    default
Arcturus  mlslabel              none                   default
Arcturus  sync                  standard               default
root@atlantis:/home# uname -a
Linux atlantis 2.6.38.3 #4 SMP Sat Apr 16 19:53:43 EDT 2011 x86_64 GNU/Linux
gunnarbeutner commented 13 years ago

This happens because zfs_get_xattrdir doesn't initialize the va_dentry member of the va variable. After applying https://github.com/gunnarbeutner/pkg-zfs/commit/16266bb0e0dc91f018e8155b2c37a806d5e1e356 I can successfully set xattr attributes for files:

root@vz3:~# echo -n value | attr -s test /mnt/mars/test
Attribute "test" set to a 5 byte value for /mnt/mars/test:
value
root@vz3:~# attr -l /mnt/mars/test
Attribute "test" has a 5 byte value for /mnt/mars/test
kkoning commented 13 years ago

Wow- that was quick! =) After applying the patch and recompiling, I am no longer able to reproduce the bugs described above. Thanks!

behlendorf commented 13 years ago

Reopening issue until I can commit this fix to master for 0.6.0-rc4. Thanks for the quick fix Gunnareutner! I'll work on reviewing and merging your other fixes next week! Thanks for all the good work!