cloned zvol's from snapshots do not appear in dev tree. When creating a zfs volume and snapshoting this volume the volume and snapshot appear just fine in the /dev tree (under /dev/zvol/...). However, when creating a clone of a snapshot, the dev tree is not updated with the new clone zvol. The only way I have been able to have the cloned zvol appear in the dev tree is to completely export the zpool and reimport it. Once the zpool has been reimported the /dev/zvol clone device appears. It might be related but deleted zvol snapshots also remain and continue to appear in the zvol dev tree after the zvol snapshot has been deleted. Fix: Pure speculation at this point: update the zfs clone code to check if the cloned dataset is a volume and create a new zvol device if the clone is a volume from the snapshot. clean/reindex the zvol dev tree when zvol snapshots are destroyed or cloned How-To-Repeat: create zfs zvol volume snapshot the zvol volume create a clone from the zvol volume snapshot try to access the zvol device from the zvol device tree under /dev/zvol/<poolname>/<zvol> No device exists Export the zpool (zpool export <poolname>) import the zpool (zpool import <poolname>) The zvol device now appears under the device tree in the proper /dev/zvol area.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I think Andriy (cc'ed) have fixed a similar issue. A quick glance at the code suggests maybe we can use something like this: Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c =================================================================== - --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c (revision 258350) +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c (working copy) @@ -3298,6 +3298,10 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, if (error != 0) (void) dsl_destroy_head(fsname); } +#ifdef __FreeBSD__ + if (error == 0) + zvol_create_minors(fsname); +#endif return (error); } Can you confirm if this helps? (I think we should use a better way to trigger zvol_create_minor, maybe via a devfs lookup hook?) Cheers, -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJSi7L6AAoJEJW2GBstM+nsU7IQAKJhuls5BEXXsvp8SsoJDZ1x 7SK4BP27cIF++hqzf4DVyP5OJEXFivFBgmbbdcS2q91X4ZR7kwdp/c7PWLArrtLO uQkQaeFpr5xvZsro6n58zVqjFc6ItaEZ0RWsv82Rqx9lVX8INb3Z/AneM2HXVXkX GDPTCf17bsxcgsxeCXgirpYYO4bOnUlTCNNmBSR62BNvQRNHwrTO+wVRVLGkZ4JK /y0GtiE2P1xhGq24XNswGqlmZPwBZHvqrvMXM1BjAdW2/kKuzWQ2HA9nflSGFK5k V502qe+fZXK4p227/9To1XfNIDC2GnONfvYOjqJigwjvd+2zENVxyLphHowfQpkw qWOgQ7b8nHc5GzjkWRJIJVm1JJHSHfAyH3VRwHBkEOGv0qs/ScM3x9mjaeqSb5Uu cIAF2vMt9gDfvgsV1fL0y33qOGFMFqPW7E0oOPGHrDMRQPUsGAeItUWCppbxmnVD HkCbPxYiH3EoFXULT8kX5gthRpbl1IveEluGGFITPxYsj1XmUvmQPBSkJPauoTvZ 0Aoe306mfuad8gmCBxpSCqTs9cvQrzeOvfc3bMKSLmSCbZ7SfnwG1EVGUMiX1DI9 1ugyRXHPlCZ/59HsEDym+Jlz/cqijo+dFykgjllwiwQtgzQSAhlaiyXjVZIxhfKL EgIpjuU+stDV10DsEwow =jwi6 -----END PGP SIGNATURE-----
I was not able to get the code patch to apply cleanly. I do support the idea of a devfs hook. I think the devfs hook is a lot cleaner and reduces the need to make sure the devnode is created/destroyed after every update to the zvols. -C On 11/19/13 12:50, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I think Andriy (cc'ed) have fixed a similar issue. A quick glance at > the code suggests maybe we can use something like this: > > > Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > =================================================================== > - --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > (revision 258350) > +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > (working copy) > @@ -3298,6 +3298,10 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, > if (error != 0) > (void) dsl_destroy_head(fsname); > } > +#ifdef __FreeBSD__ > + if (error == 0) > + zvol_create_minors(fsname); > +#endif > return (error); > } > > Can you confirm if this helps? > > (I think we should use a better way to trigger zvol_create_minor, > maybe via a devfs lookup hook?) > > Cheers, > -----BEGIN PGP SIGNATURE----- > > iQIcBAEBCgAGBQJSi7L6AAoJEJW2GBstM+nsU7IQAKJhuls5BEXXsvp8SsoJDZ1x > 7SK4BP27cIF++hqzf4DVyP5OJEXFivFBgmbbdcS2q91X4ZR7kwdp/c7PWLArrtLO > uQkQaeFpr5xvZsro6n58zVqjFc6ItaEZ0RWsv82Rqx9lVX8INb3Z/AneM2HXVXkX > GDPTCf17bsxcgsxeCXgirpYYO4bOnUlTCNNmBSR62BNvQRNHwrTO+wVRVLGkZ4JK > /y0GtiE2P1xhGq24XNswGqlmZPwBZHvqrvMXM1BjAdW2/kKuzWQ2HA9nflSGFK5k > V502qe+fZXK4p227/9To1XfNIDC2GnONfvYOjqJigwjvd+2zENVxyLphHowfQpkw > qWOgQ7b8nHc5GzjkWRJIJVm1JJHSHfAyH3VRwHBkEOGv0qs/ScM3x9mjaeqSb5Uu > cIAF2vMt9gDfvgsV1fL0y33qOGFMFqPW7E0oOPGHrDMRQPUsGAeItUWCppbxmnVD > HkCbPxYiH3EoFXULT8kX5gthRpbl1IveEluGGFITPxYsj1XmUvmQPBSkJPauoTvZ > 0Aoe306mfuad8gmCBxpSCqTs9cvQrzeOvfc3bMKSLmSCbZ7SfnwG1EVGUMiX1DI9 > 1ugyRXHPlCZ/59HsEDym+Jlz/cqijo+dFykgjllwiwQtgzQSAhlaiyXjVZIxhfKL > EgIpjuU+stDV10DsEwow > =jwi6 > -----END PGP SIGNATURE-----
on 19/11/2013 20:50 Xin Li said the following: > I think Andriy (cc'ed) have fixed a similar issue. A quick glance at the > code suggests maybe we can use something like this: I am not sure if I have ever fixed this -- if you have a reference then please share with :-) But the change looks good to me and I also think that Steve Hartland proposed this change as well. Thanks! And sorry for the delay with my reply. > Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > =================================================================== --- > sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c (revision > 258350) +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > (working copy) @@ -3298,6 +3298,10 @@ zfs_ioc_clone(const char *fsname, > nvlist_t *innvl, if (error != 0) (void) dsl_destroy_head(fsname); } +#ifdef > __FreeBSD__ + if (error == 0) + > zvol_create_minors(fsname); +#endif return (error); } > > Can you confirm if this helps? > > (I think we should use a better way to trigger zvol_create_minor, maybe via > a devfs lookup hook?) > > Cheers, > -- Andriy Gapon
on 27/01/2014 22:29 Christopher Harrison said the following: > I was not able to get the code patch to apply cleanly. I do support the idea > of a devfs hook. I think the devfs hook is a lot cleaner and reduces the need > to make sure the devnode is created/destroyed after every update to the zvols. Sorry, but having said "*the* devfs hook" could you please provide any reference or context? I am not aware of any zvol related devfs hook. -- Andriy Gapon
FYI, this is a dupe of kern/178999.
State Changed From-To: open->closed see kern/178999.
Responsible Changed From-To: freebsd-bugs->freebsd-fs