Bug 167066

Summary: [zfs] ZVOLs not appearing in /dev/zvol
Product: Base System Reporter: Aldo <rimbalza>
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.0-RELEASE   
Hardware: Any   
OS: Any   

Description Aldo 2012-04-18 17:30:03 UTC
I do 
zfs send -I mypool/iscsi0@20120415 mypool/iscsi0@20120416 |
ssh root@bckserver zfs receive -v cloned/iscsi0

from my machine where the iscsi0 zvol is backing an iscsi target.

The receiving machine gets it, it appears in "zfs list" but no corresponding
device is created in /dev/zvol. If I reboot the machine the device appears
and works ok.

If I create a new zvol on the receiving machine, the device appears.
Only zfs received zvols do not appear.

Also, zfs rollback cloned@iscsi0@mysnap never returns the prompt. Top says
zfs is stuck in STOP state. After a reboot the command succedes.

Using v28 pool upgraded froma v15 created on OpenSolaris.

Fix: 

Reboot the server
How-To-Repeat: Send a zvol from from machine A to machine B.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-04-23 04:16:54 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-fs

reclassify.
Comment 2 Andriy Gapon freebsd_committer freebsd_triage 2012-11-23 11:22:26 UTC
Please try the following patch:

--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -3824,6 +3824,11 @@ zfs_ioc_recv(zfs_cmd_t *zc)
 		error = 1;
 	}
 #endif
+
+#ifdef __FreeBSD__
+	if (error == 0)
+		zvol_create_minors(tofs);
+#endif
 	/*
 	 * On error, restore the original props.
 	 */

-- 
Andriy Gapon
Comment 3 andrnils 2012-11-23 13:04:16 UTC
On Fri, Nov 23, 2012 at 12:22 PM, Andriy Gapon <avg@freebsd.org> wrote:

>
> Please try the following patch:
>
> --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
> +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
> @@ -3824,6 +3824,11 @@ zfs_ioc_recv(zfs_cmd_t *zc)
>                 error = 1;
>         }
>  #endif
> +
> +#ifdef __FreeBSD__
> +       if (error == 0)
> +               zvol_create_minors(tofs);
> +#endif
>         /*
>          * On error, restore the original props.
>          */
>
> --
> Andriy Gapon
>

Thanks :)

The patch did not apply on new checkout of 9-stable, but I added the code
via editor. Svn thinks this of my edit:

Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c  (revision
243443)
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c  (working
copy)
@@ -3803,6 +3803,11 @@
                error = 1;
        }
 #endif
+
+#ifdef __FreeBSD__
+       if (error == 0)
+               zvol_create_minors(tofs);
+#endif
        /*
         * On error, restore the original props.
         */

Before receive:
$ ls /dev/zvol/data/
usb     usb@2   usb@2s1 usbs1

After receive:
$ ls /dev/zvol/data/
master          master@1p1      master@1p3      masterp2        usb
    usb@2s1
master@1        master@1p2      masterp1        masterp3        usb@2
    usbs1

which is what I expected. Great work :)

Best regards
Andreas
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2012-11-24 13:13:49 UTC
Responsible Changed
From-To: freebsd-fs->avg

I am handling this.
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2012-12-01 18:24:49 UTC
State Changed
From-To: open->patched

Should be fixed in head.
Comment 6 Andriy Gapon freebsd_committer freebsd_triage 2013-01-21 15:45:15 UTC
State Changed
From-To: patched->closed

Should be fixed now.