Bug 178999 - [zfs] dev entries for cloned zvol don't show up until after reboot
Summary: [zfs] dev entries for cloned zvol don't show up until after reboot
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 1.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Steven Hartland
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-27 02:30 UTC by Steve Wills
Modified: 2018-05-28 19:45 UTC (History)
2 users (show)

See Also:


Attachments
zvol-fixes.patch (6.28 KB, patch)
2013-08-04 14:36 UTC, Steven Hartland
no flags Details | Diff
file.dat (2.32 KB, application/http-index-format)
2013-08-29 03:56 UTC, Steve Wills
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Wills freebsd_committer freebsd_triage 2013-05-27 02:30:01 UTC
When creating a zvol on a zfs pool, the /dev/zvol/pool/* entries show up correctly, however when making snapshots or cloning them, they do not.

How-To-Repeat: 
zfs create -V 1G pool/somevol
ls /dev/zvol/pool # witness somevol entries
zfs create pool/somevol@somesnap
ls /dev/zvol/pool # witness no new entries
zfs clone pool/somvol@somesnap pool/anothervol
ls /dev/zvol/pool # again witness no new entries
reboot
ls /dev/zvol/pool # witness missing entries appearing
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-05-28 00:30:01 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Steven Hartland freebsd_committer freebsd_triage 2013-06-11 15:21:02 UTC
Responsible Changed
From-To: freebsd-fs->smh

I'll take it
Comment 3 Steven Hartland freebsd_committer freebsd_triage 2013-06-11 15:24:39 UTC
Potential fix submitted by Ruslan Bukin here:
http://lists.freebsd.org/pipermail/freebsd-fs/2013-June/017420.html
--- zfs_ioctl.c 2013-06-09 23:54:22.386708932 +0400
+++ zfs_ioctl.c 2013-06-10 00:21:58.161708460 +0400
@@ -3299,6 +3299,12 @@
       if (error != 0)
              (void) dsl_destroy_head(fsname);
        }
+
+#ifdef __FreeBSD__
+        if (error == 0)
+                zvol_create_minors(fsname);
+#endif
+
 return (error);
 }
Comment 4 Kurt Lidl freebsd_committer freebsd_triage 2013-08-02 19:27:33 UTC
Any chance this PR could be reviewed, and if the patch is good,
committed?

I just ran into this same problem last night.

It's really handy to be able to just clone a zvol for
creating a throwaway virtual machine with bhyve.  It's
less good if you have to reboot the host machine
to make the zvol appear.

I just applied the patch in this PR to my 10-CURRENT tree, and have
verified that cloned zvols now show up in /dev/zvol - without
the patch, they do not.

Thanks!

-Kurt
Comment 5 Steven Hartland freebsd_committer freebsd_triage 2013-08-04 14:36:47 UTC
While testing this patch I hit a number of other issues with zvol's
including missing creates, failure rename and deadlock scenarios.

The attached patch looks to address these. It doesn't solve all
the possible deadlock issues with zvol's, what would require
significant extra work, but it does address all the rename and
creation issues I experienced.

If you could please test this patch and see if you encounter
any new issues that would be appreciated.

    regards
    Steve
Comment 6 Steve Wills freebsd_committer freebsd_triage 2013-08-29 03:56:12 UTC
Hi,

Patch does seem to solve the issue, thanks!

Steve
Comment 7 kash 2013-12-15 00:17:15 UTC
This fix did not resolve the issue for me, experienced on 9.2-STABLE and 
9.1-RELEASE.
Comment 8 Irwin 2014-01-21 01:36:23 UTC
I'm still experiencing this issue in FreeBSD 10.0-RELEASE. I'm curious 
if this is a bug for everyone or if it happens only under certain 
circumstances.
Comment 9 ivan.natchkov 2014-01-29 22:26:12 UTC
We experienced the same problem with FreeBSD 10.0-RELEASE #0 r260789. With
9.1 everything was fine. The submitted patch here didn't work out for us.
We use this feature to clone our production environment and create fresh
test and development servers in a minute. Hope to find solution soon.
Comment 10 dfilter service freebsd_committer freebsd_triage 2014-04-11 12:56:19 UTC
Author: mav
Date: Fri Apr 11 11:56:16 2014
New Revision: 264341
URL: http://svnweb.freebsd.org/changeset/base/264341

Log:
  Create zvol devices on zfs clone.
  
  While big and shiny patch is not ready, it is better to have something.
  
  PR:		kern/178999
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr 11 08:25:54 2014	(r264340)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr 11 11:56:16 2014	(r264341)
@@ -3352,6 +3352,10 @@ zfs_ioc_clone(const char *fsname, nvlist
 		if (error != 0)
 			(void) dsl_destroy_head(fsname);
 	}
+#ifdef __FreeBSD__
+	if (error == 0)
+		zvol_create_minors(fsname);
+#endif
 	return (error);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 11 dfilter service freebsd_committer freebsd_triage 2014-04-21 17:33:52 UTC
Author: mav
Date: Mon Apr 21 16:33:49 2014
New Revision: 264729
URL: http://svnweb.freebsd.org/changeset/base/264729

Log:
  MFC r264341:
  Create zvol devices on zfs clone.
  
  While big and shiny patch is not ready, it is better to have something.
  
  PR:		kern/178999

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Apr 21 16:29:54 2014	(r264728)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Apr 21 16:33:49 2014	(r264729)
@@ -3352,6 +3352,10 @@ zfs_ioc_clone(const char *fsname, nvlist
 		if (error != 0)
 			(void) dsl_destroy_head(fsname);
 	}
+#ifdef __FreeBSD__
+	if (error == 0)
+		zvol_create_minors(fsname);
+#endif
 	return (error);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 12 dfilter service freebsd_committer freebsd_triage 2014-04-21 17:35:17 UTC
Author: mav
Date: Mon Apr 21 16:35:14 2014
New Revision: 264730
URL: http://svnweb.freebsd.org/changeset/base/264730

Log:
  MFC r264341:
  Create zvol devices on zfs clone.
  
  While big and shiny patch is not ready, it is better to have something.
  
  PR:             kern/178999

Modified:
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Apr 21 16:33:49 2014	(r264729)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Apr 21 16:35:14 2014	(r264730)
@@ -3352,6 +3352,10 @@ zfs_ioc_clone(const char *fsname, nvlist
 		if (error != 0)
 			(void) dsl_destroy_head(fsname);
 	}
+#ifdef __FreeBSD__
+	if (error == 0)
+		zvol_create_minors(fsname);
+#endif
 	return (error);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 13 Simon Boulet 2014-09-30 18:06:53 UTC
Any updates on this? Also having this issue, on 10.0-RELEASE. Is there a workaround to rebuild the devices in /dev/zvol to access a newly created clone without rebooting?
Comment 14 kash 2014-10-02 06:01:35 UTC
(In reply to Steven Hartland from comment #5)
> While testing this patch I hit a number of other issues with zvol's
> including missing creates, failure rename and deadlock scenarios.
> 
> The attached patch looks to address these. It doesn't solve all
> the possible deadlock issues with zvol's, what would require
> significant extra work, but it does address all the rename and
> creation issues I experienced.
> 
> If you could please test this patch and see if you encounter
> any new issues that would be appreciated.
> 
>     regards
>     Steve

I think my issue with rename is somewhat similar, if not identical to what you attempted to resolve here. I tried to rename a clone of a ZVOL (both have several snapshots with their own clones) about 10 times in a row, it hangs and I/O crashes. See #193803
Comment 15 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:45:55 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.