Bug 216881 - zpool detach hangs if autoexpand is set to on.
Summary: zpool detach hangs if autoexpand is set to on.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-07 12:26 UTC by Mike Clarke
Modified: 2017-02-10 16:26 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Clarke 2017-02-07 12:26:45 UTC
FreeBSD curlew.lan 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

zpool detach hangs and eventually freezes the entire system if autoexpand is set to on.

After rebooting the detached device is still shown in the pool but is inaccessible and cannot be removed

For example, starting with this pool:

	root@fbsd11:~ # zpool status

	pool: test
	state: ONLINE
	scan: resilvered 74.5K in 0h0m with 0 errors on Mon Feb  6 13:55:04 2017
	config:

		NAME            STATE     READ WRITE CKSUM
		test            ONLINE       0     0     0
		mirror-0      ONLINE       0     0     0
			gpt/ztest1  ONLINE       0     0     0
			gpt/ztest2  ONLINE       0     0     0

	errors: No known data errors
	
	root@fbsd11:~ # zpool get autoexpand

	NAME  PROPERTY    VALUE   SOURCE
	test  autoexpand  on      local

If I attempt to detach test gpt/ztest2 it hangs and after rebooting I have the following:

	root@fbsd11:~ # zpool status

	pool: test
	state: DEGRADED
	status: One or more devices could not be opened.  Sufficient replicas exist for
		the pool to continue functioning in a degraded state.
	action: Attach the missing device and online it using 'zpool online'.
		see: http://illumos.org/msg/ZFS-8000-2Q
	scan: resilvered 74.5K in 0h0m with 0 errors on Mon Feb  6 13:55:04 2017
	config:

		NAME                      STATE     READ WRITE CKSUM
		test                      DEGRADED     0     0     0
		mirror-0                DEGRADED     0     0     0
			gpt/ztest1            ONLINE       0     0     0
			12467057712079289495  UNAVAIL      0     0     0  was /dev/gpt/ztest2

	errors: No known data errors

At this stage the former gpt/ztest2 cannot be detached or reattached until I set autoexpand to off which then enables me to detach it.

A similar problem was resolved with FreeNAS in November and might be relevant - https://bugs.pcbsd.org/issues/14337
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2017-02-10 15:17:08 UTC
FreeBSD 11.0 was released before the fix.
You should see the fix in 11.1 or you can switch to stable/11 now.
Comment 2 Mike Clarke 2017-02-10 15:45:42 UTC
Thanks.
I'll wait for 11.1. In the meantime switching off autoexpand  is OK as a workaround.
Comment 3 Steven Hartland freebsd_committer freebsd_triage 2017-02-10 16:13:02 UTC
For reference do you know the particular commit which fixed this Andriy?
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2017-02-10 16:19:18 UTC
I believe that it was base r308055.
Alexander, could you please confirm?
Comment 5 Alexander Motin freebsd_committer freebsd_triage 2017-02-10 16:26:29 UTC
(In reply to Andriy Gapon from comment #4)
It was fixed from two different sides: r308051 and r308055.