Page MenuHomeFreeBSD

Add a sysctl to allow ZFS pools backed by zvols
ClosedPublic

Authored by asomers on Jan 19 2016, 11:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 4:20 PM
Unknown Object (File)
Fri, Apr 19, 4:20 PM
Unknown Object (File)
Fri, Apr 19, 4:20 PM
Unknown Object (File)
Fri, Apr 19, 4:20 PM
Unknown Object (File)
Wed, Apr 17, 12:39 AM
Unknown Object (File)
Feb 9 2024, 12:59 AM
Unknown Object (File)
Jan 30 2024, 2:53 AM
Unknown Object (File)
Jan 30 2024, 2:52 AM

Details

Summary

Change 294329 removed the ability to build ZFS pools that are backed by zvols,
because having that ability (even if it's not used) leads to deadlocks. By
popular demand, I'm adding an off-by-default sysctl to reenable that ability.

Test Plan

Create a mirrored pool named foo
Create a pool named bar, and create a zvol on it
Remove one of foo's disks
In one terminal, do "zpool status foo" in a while loop
In another terminal, do "zpool online foo <removed disk's guid>" in a while loop
Verify that no deadlocks result after a few minutes, then kill both loops

Try to create a zpool on bar's zvol. It should fail.
Do "sysctl vfs.zfs.vol.recursive=1".
Try to create a zpool on bar's zvol. It should succeed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers retitled this revision from to Add a sysctl to allow ZFS pools backed by zvols.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: delphij, lidl, se.

Just some style nits.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
138 ↗(On Diff #12484)

style(9) line length

1119 ↗(On Diff #12484)

style(9) define at the top of method and just init here.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
138 ↗(On Diff #12484)

I'll fix it.

1119 ↗(On Diff #12484)

locked is only used when #ifndef illumos. Therefore, it must be declared in a #ifndef illumos section. It's current location is the highest point in the function when illumos is not defined.

style(9) fixed suggested by smh

lidl edited edge metadata.

I built a kernel with this patch in it.

I ran my script without setting the sysctl. It failed, as expected.
I set the sysctl, and re-ran my script. It succeeded.

I am satisfied with this solution.

This revision is now accepted and ready to land.Jan 21 2016, 2:17 AM
avg added inline comments.
UPDATING
36 ↗(On Diff #12486)

I would prefer that "never really worked" statement was toned down a little bit.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
138 ↗(On Diff #12486)

I am a little bit concerned about what happens if this knob is switched off at run-time with some zpools-on-zvols already active.

UPDATING
36 ↗(On Diff #12486)

How about "That feature has never worked safely; it's always been prone to deadlocks."?

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
138 ↗(On Diff #12486)

Nothing will happen, since the knob only affects tasting. If you have an active pool on zvols and you switch the knob off, I/O to the pool will still work. You can even export the pool. But then you won't be able to import it again, and you won't be able to do operations like offline a zvol vdev and online it, or replace a zvol vdev with another zvol.

delphij edited edge metadata.
This revision was automatically updated to reflect the committed changes.