Concurrent zfs create and rename operations can lock a zpool completely
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Incomplete
|
Undecided
|
Unassigned | ||
zfs-linux (Ubuntu) |
Fix Released
|
High
|
Colin Ian King |
Bug Description
When doing "zfs create -V" and "zfs rename" operations on the same zpool in parallel, there is a high chance for a deadlock leading to a complete hang of the zpool in question (i.e., all further zfs operations hang indefinitely).
Attached you find a simple perl script that should trigger the bug (the pool variable needs to be set to your pool name), if run in two shells at the same time:
$ for i in `seq 1 100`; do sudo ./zfsrenamebug.pl "A$i"; done
$ for i in `seq 1 100`; do sudo ./zfsrenamebug.pl "B$i"; done
Reported upstream in https:/
---
ApportVersion: 2.20-0ubuntu3
Architecture: amd64
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CurrentDesktop: Unity
DistroRelease: Ubuntu 16.04
HibernationDevice: RESUME=
InstallationDate: Installed on 2016-03-18 (4 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20160307)
IwConfig:
ens18 no wireless extensions.
lo no wireless extensions.
Lsusb: Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
NonfreeKernelMo
Package: zfs-linux
ProcFB: 0 qxldrmfb
ProcKernelCmdLine: BOOT_IMAGE=
ProcVersionSign
RelatedPackageV
linux-
linux-
linux-firmware 1.157
RfKill:
Tags: xenial
Uname: Linux 4.4.0-15-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: rel-1.8.
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.
dmi.modalias: dmi:bvnSeaBIOS:
dmi.product.name: Standard PC (i440FX + PIIX, 1996)
dmi.product.
dmi.sys.vendor: QEMU
Changed in zfs-linux (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Colin Ian King (colin-king) |
Changed in zfs-linux (Ubuntu): | |
status: | In Progress → Fix Released |
Stack traces of hanging processes collected via /proc/<PID>/stack:
proc-1519- stack.log: c49>] cv_wait_ common+ 0x109/0x140 [spl] cb5>] __cv_wait_ sig+0x15/ 0x20 [spl] 131>] txg_quiesce_ thread+ 0x3e1/0x3f0 [zfs] e41>] thread_ generic_ wrapper+ 0x71/0x80 [spl] 3e8>] kthread+0xd8/0xf0 38f>] ret_from_ fork+0x3f/ 0x70 fff>] 0xffffffffffffffff stack.log: b18>] zvol_rename_ minors+ 0x58/0x190 [zfs] add>] dsl_dir_ rename_ sync+0x31d/ 0x5a0 [zfs] f69>] dsl_sync_ task_sync+ 0xe9/0xf0 [zfs] f77>] dsl_pool_ sync+0x327/ 0x430 [zfs] 536>] spa_sync+ 0x366/0xb30 [zfs] 9ba>] txg_sync_ thread+ 0x3ba/0x630 [zfs] e41>] thread_ generic_ wrapper+ 0x71/0x80 [spl] 3e8>] kthread+0xd8/0xf0 38f>] ret_from_ fork+0x3f/ 0x70 fff>] 0xffffffffffffffff stack.log: c49>] cv_wait_ common+ 0x109/0x140 [spl] cb5>] __cv_wait_ sig+0x15/ 0x20 [spl] 008>] zfs_zevent_ wait+0x88/ 0xa0 [zfs] b46>] zfs_ioc_ events_ next+0xa6/ 0xe0 [zfs] 5a3>] zfsdev_ ioctl+0x423/ 0x4b0 [zfs] 7df>] do_vfs_ ioctl+0x29f/ 0x490 a49>] SyS_ioctl+0x79/0x90 ff2>] entry_SYSCALL_ 64_fastpath+ 0x16/0x71 fff>] 0xffffffffffffffff stack.log: c49>] cv_wait_ common+ 0x109/0x140 [spl] c95>] __cv_wait+0x15/0x20 [spl] e8c>] rrw_enter_ read_impl+ 0x4c/0x160 [zfs] 17c>] rrw_enter+0x1c/0x20 [zfs] eaa>] dsl_pool_ hold+0x5a/ 0x80 [zfs] 244>] dmu_objset_ own+0x44/ 0xd0 [zfs] 9e7>] __zvol_ create_ minor+0x127/ 0x640 [zfs] 763>] zvol_create_ minor+0x33/ 0x70 [zfs] 7ae>] zvol_create_ minors_ cb+0xe/ 0x20 [zfs] 872>] dmu_objset_ find_impl+ 0x112/0x3f0 [zfs] ba8>] dmu_objset_ find+0x58/ 0x90 [zfs] 949>] zvol_create_ minors+ 0x29/0x30 [zfs] 870>] zfs_ioc_ create+ 0x190/0x2a0 [zfs] 398>] zfsdev_ ioctl+0x218/ 0x4b0 [zfs] 7df>] do_vfs_ ioctl+0x29f/ 0x490 a49>] SyS_ioctl+0x79/0x90 ff2>] entry_SYSCALL_ 64_fastpath+ 0x16/0x71 fff>] 0xffffffffffffffff stack.log: c49>] cv_wait_ common+ 0x109/0x140 [spl] c95>] __cv_wait+0x15/0x20 [spl] 225>] txg_wait_ synced+ 0xe5/0x130 [zfs] ca9>] dsl_sync_ task+0x179/ 0x260 [zfs] 53b>] dsl_dir_ rename+ 0x5b/0x80 [zfs] 13d>] zfs_ioc_ rename+ 0x10d/0x120 [zfs] 5a3>] zfsdev_ ioctl+0x423/ 0x4b0 [zfs] 7df>] do_vfs_ ioctl+0x29f/ 0x490 a49>] SyS_ioctl+0x79/0x90 ff2>] entry_SYSCALL_ 64_fastpath+ 0x16/0x71 fff>] 0xffffffffffffffff
[<ffffffffc01ad
[<ffffffffc01ad
[<ffffffffc02bc
[<ffffffffc01a8
[<ffffffff8109f
[<ffffffff81822
[<fffffffffffff
proc-1520-
[<ffffffffc0311
[<ffffffffc028e
[<ffffffffc0297
[<ffffffffc028f
[<ffffffffc02ab
[<ffffffffc02bc
[<ffffffffc01a8
[<ffffffff8109f
[<ffffffff81822
[<fffffffffffff
proc-1763-
[<ffffffffc01ad
[<ffffffffc01ad
[<ffffffffc0299
[<ffffffffc02df
[<ffffffffc02e4
[<ffffffff8121e
[<ffffffff8121e
[<ffffffff81821
[<fffffffffffff
proc-7027-
[<ffffffffc01ad
[<ffffffffc01ad
[<ffffffffc02a0
[<ffffffffc02a1
[<ffffffffc0290
[<ffffffffc026d
[<ffffffffc030f
[<ffffffffc0311
[<ffffffffc0311
[<ffffffffc026e
[<ffffffffc026e
[<ffffffffc0311
[<ffffffffc02e6
[<ffffffffc02e4
[<ffffffff8121e
[<ffffffff8121e
[<ffffffff81821
[<fffffffffffff
proc-7038-
[<ffffffffc01ad
[<ffffffffc01ad
[<ffffffffc02bc
[<ffffffffc0297
[<ffffffffc028d
[<ffffffffc02e0
[<ffffffffc02e4
[<ffffffff8121e
[<ffffffff8121e
[<ffffffff81821
[<fffffffffffff