Author: avg
Date: Sat Oct  6 19:42:50 2012
New Revision: 241292
URL: http://svn.freebsd.org/changeset/base/241292

Log:
  zfs loader: treat plain pool name as a name of its root dataset
  
  ... as opposed to the previous behavior of treating it as boot
  dataset (specified by bootfs or default)
  
  MFC after:    19 days

Modified:
  head/sys/boot/zfs/zfs.c

Modified: head/sys/boot/zfs/zfs.c
==============================================================================
--- head/sys/boot/zfs/zfs.c     Sat Oct  6 19:42:05 2012        (r241291)
+++ head/sys/boot/zfs/zfs.c     Sat Oct  6 19:42:50 2012        (r241292)
@@ -617,12 +617,9 @@ zfs_parsedev(struct zfs_devdesc *dev, co
        if (!spa)
                return (ENXIO);
        dev->pool_guid = spa->spa_guid;
-       if (rootname[0] != '\0') {
-               rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid);
-               if (rv != 0)
-                       return (rv);
-       } else
-               dev->root_guid = 0;
+       rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid);
+       if (rv != 0)
+               return (rv);
        if (path != NULL)
                *path = (*end == '\0') ? end : end + 1;
        dev->d_dev = &zfs_dev;
@@ -642,9 +639,10 @@ zfs_fmtdev(void *vdev)
        if (dev->d_type != DEVT_ZFS)
                return (buf);
 
-       if (dev->pool_guid == 0)
+       if (dev->pool_guid == 0) {
                spa = STAILQ_FIRST(&zfs_pools);
-       else
+               dev->pool_guid = spa->spa_guid;
+       } else
                spa = spa_find_by_guid(dev->pool_guid);
        if (spa == NULL) {
                printf("ZFS: can't find pool by guid\n");
@@ -682,19 +680,17 @@ zfs_list(const char *name)
        if (dsname != NULL) {
                len = dsname - name;
                dsname++;
-       }
+       } else
+               dsname = "";
        memcpy(poolname, name, len);
        poolname[len] = '\0';
 
        spa = spa_find_by_name(poolname);
        if (!spa)
                return (ENXIO);
-       if (dsname != NULL)
-               rv = zfs_lookup_dataset(spa, dsname, &objid);
-       else
-               rv = zfs_get_root(spa, &objid);
+       rv = zfs_lookup_dataset(spa, dsname, &objid);
        if (rv != 0)
                return (rv);
        rv = zfs_list_dataset(spa, objid);
-       return (0);
+       return (rv);
 }
_______________________________________________
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-unsubscr...@freebsd.org"

Reply via email to