Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAME_ERR_DISKLIKE is Solaris specific in module/zcommon/zfs_namecheck.c #11781

Closed
blastwave opened this issue Mar 23, 2021 · 3 comments · Fixed by #11813
Closed

NAME_ERR_DISKLIKE is Solaris specific in module/zcommon/zfs_namecheck.c #11781

blastwave opened this issue Mar 23, 2021 · 3 comments · Fixed by #11813
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@blastwave
Copy link

Looking at module/zcommon/zfs_namecheck.c at line 453 we see :

   453    if (pool[0] == 'c' && (pool[1] >= '0' && pool[1] <= '9')) {
   454        if (why)
   455            *why = NAME_ERR_DISKLIKE;
   456        return (-1);
   457    }

The end result is that zpool create with a name like "c0" fails for 
no valid reason.  Certainly on FreeBSD this has been an issue for some
time now : 

    ZFS NAME_ERR_DISKLIKE check is Solaris-specific
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=159356

Should be a trivial fix. 

The alternative would be a pile of ifdef and checking for things like
ada0 and da0 and sda0.  Perhaps these days are in the distant history
and the error NAME_ERR_DISKLIKE may not be reasonable anymore.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
@blastwave blastwave added Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang) labels Mar 23, 2021
@blastwave
Copy link
Author

I have done some testing on FreeBSD current and there seems to be no valid reason to restrict the zpool names away from "c[0-9]" type strings. I did create and destroy c0ffee as well as the obvious c0. Seems all to work just fine of course :

europa# 
europa# zpool create -o cachefile=/boot/zfs/zpool.cache -m none -O compress=zstd -O checksum=sha512 -O atime=on -O xattr=on -o autoexpand=on -o autoreplace=on -o failmode=continue -o listsnaps=on -O dedup=off -O copies=1 -O canmount=off -m none c0ffee mirror ada3p1 ada2p1 
europa# zpool list
NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
c0ffee   464G   176K   464G        -         -     0%     0%  1.00x    ONLINE  -
z0      95.5G  18.9G  76.6G        -         -     8%    19%  1.00x    ONLINE  -
europa# 
europa# 
europa# zpool destroy c0ffee
europa# 
europa# 
europa# zpool create -o cachefile=/boot/zfs/zpool.cache -m none -O compress=zstd -O checksum=sha512 -O atime=on -O xattr=on -o autoexpand=on -o autoreplace=on -o failmode=continue -o listsnaps=on -O dedup=off -O copies=1 -O canmount=off -m none c0 mirror ada3p1 ada2p1
europa# zpool list
NAME   SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
c0     464G   162K   464G        -         -     0%     0%  1.00x    ONLINE  -
z0    95.5G  18.9G  76.6G        -         -     8%    19%  1.00x    ONLINE  -
europa# 
.
.
.
europa# zfs recv -Fvu c0 < /var/tmp/root/z1_20210323231220.capR
receiving full stream of z1@20210301132814 into c0@20210301132814
received 46.0K stream in 1 seconds (46.0K/sec)
receiving incremental stream of z1@20210311172455 into c0@20210311172455
received 312B stream in 1 seconds (312B/sec)
receiving incremental stream of z1@20210323231220 into c0@20210323231220
received 312B stream in 1 seconds (312B/sec)
receiving full stream of z1/usr@20210301132814 into c0/usr@20210301132814
received 46.0K stream in 1 seconds (46.0K/sec)
receiving incremental stream of z1/usr@20210311172455 into c0/usr@20210311172455
received 312B stream in 1 seconds (312B/sec)
.
.
.
receiving full stream of z1/freebsd_src@20210323231220 into c0/freebsd_src@20210323231220
received 3.28G stream in 50 seconds (67.1M/sec)
europa# zfs list -r -t all c0 
NAME                            USED  AVAIL     REFER  MOUNTPOINT
c0                             12.7G   437G       24K  none
c0@20210301132814                 0B      -       24K  -
c0@20210311172455                 0B      -       24K  -
c0@20210323231220                 0B      -       24K  -
c0/freebsd_src                 2.33G   437G     2.33G  /usr/src
c0/freebsd_src@20210323231220     0B      -     2.33G  -
c0/opt                         6.35G   437G     8.40M  /opt
c0/opt@20200930084425            28K      -     8.28M  -
c0/opt@20200930093340            28K      -     8.28M  -
c0/opt@20201219110739           123K      -     8.41M  -
c0/opt@20210117031410           123K      -     8.41M  -
c0/opt@20210121200001           125K      -     8.40M  -
c0/opt@20210130051352           124K      -     8.40M  -
c0/opt@20210220023743           124K      -     8.40M  -
c0/opt@20210301132814           123K      -     8.40M  -
c0/opt@20210311172455           124K      -     8.40M  -
c0/opt@20210315070355           123K      -     8.39M  -
c0/opt@20210323231220             0B      -     8.40M  -
c0/opt/bw                      6.32G   437G     6.09G  /opt/bw
c0/opt/bw@20200930084425          0B      -     1.52G  -
c0/opt/bw@20200930093340          0B      -     1.52G  -
c0/opt/bw@20201219110739       5.66M      -     1.75G  -
c0/opt/bw@20210117031410        212K      -     4.16G  -
c0/opt/bw@20210117194637        154K      -     4.16G  -
c0/opt/bw@20210121200001       10.7M      -     4.16G  -
c0/opt/bw@20210130051352       10.8M      -     4.16G  -
c0/opt/bw@20210220023743       10.7M      -     4.16G  -
c0/opt/bw@20210301132814       71.9M      -     4.54G  -
c0/opt/bw@20210311172455       18.0M      -     6.09G  -
c0/opt/bw@20210315070355       18.0M      -     6.09G  -
c0/opt/bw@20210323231220          0B      -     6.09G  -
c0/test                          36K   437G       36K  /var/tmp/test
c0/test@20210323231220            0B      -       36K  -
c0/usr                         4.00G   437G       24K  none
c0/usr@20210301132814             0B      -       24K  -
c0/usr@20210311172455             0B      -       24K  -
c0/usr@20210323231220             0B      -       24K  -
c0/usr/home                    4.00G   437G     3.01G  /usr/home
c0/usr/home@20200930084425     52.5K      -      569M  -
c0/usr/home@20200930093340     53.5K      -      569M  -
c0/usr/home@20201219110740     3.32M      -     2.81G  -
c0/usr/home@20210117031410     4.04M      -     2.89G  -
c0/usr/home@20210121200001     4.08M      -     2.89G  -
c0/usr/home@20210130051352     4.07M      -     2.89G  -
c0/usr/home@20210220023743      160K      -     2.89G  -
c0/usr/home@20210301132814      161K      -     2.88G  -
c0/usr/home@20210311172455     3.88M      -     2.88G  -
c0/usr/home@20210323231220        0B      -     3.01G  -
europa# 
europa# zpool status c0
  pool: c0
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        c0          ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada3p1  ONLINE       0     0     0
            ada2p1  ONLINE       0     0     0

errors: No known data errors
europa# zpool scrub c0 
europa# 
europa# zpool status c0
  pool: c0
 state: ONLINE
  scan: scrub repaired 0B in 00:03:57 with 0 errors on Wed Mar 24 00:48:42 2021
config:

        NAME        STATE     READ WRITE CKSUM
        c0          ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada3p1  ONLINE       0     0     0
            ada2p1  ONLINE       0     0     0

errors: No known data errors
europa# 

Seems to all be wonderful.

@ghost
Copy link

ghost commented Mar 25, 2021

Would you like to open a pull request? Otherwise I'm happy to take care of it.

@ghost ghost removed the Status: Triage Needed New issue which needs to be triaged label Mar 25, 2021
@blastwave
Copy link
Author

Please feel free to make this itty bitty teeny little comment happen such that we can all have c0ffee zpools.
Thus :

Index: sys/contrib/openzfs/module/zcommon/zfs_namecheck.c 
===================================================================
--- sys/contrib/openzfs/module/zcommon/zfs_namecheck.c 
+++ sys/contrib/openzfs/module/zcommon/zfs_namecheck.c 
@@ -450,11 +450,16 @@
                return (-1);
        }
 
+       /* We really do not need this historical artifact 
+        *  as this was entirely a Solaris and OpenSolaris concern 
+        * Dennis Clarke dclarke@blastwave.org
+        *
        if (pool[0] == 'c' && (pool[1] >= '0' && pool[1] <= '9')) {
                if (why)
                        *why = NAME_ERR_DISKLIKE;
                return (-1);
        }
+       */
 
        return (0);
 }


Given that I have a passing familiarity with this Solaris thing I can
say that we really never should have checked for c[0-9] type names and
just let the sysadmin do what they do. After all, UNIX and Linux does
not wrap the root user in cotton balls to protect them from themselves. 

-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

behlendorf pushed a commit that referenced this issue Apr 1, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #11781 
Closes #11813
behlendorf pushed a commit that referenced this issue Apr 7, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #11781 
Closes #11813
adamdmoss pushed a commit to adamdmoss/zfs that referenced this issue Apr 10, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 7, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
ghost pushed a commit to truenas/zfs that referenced this issue May 13, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
behlendorf pushed a commit that referenced this issue May 20, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #11781 
Closes #11813
sempervictus pushed a commit to sempervictus/zfs that referenced this issue May 31, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#11781 
Closes openzfs#11813
tonyhutter pushed a commit that referenced this issue Jun 23, 2021
Nothing bad happens if a prefix of your pool name matches a disk name.
This is a bit of a silly restriction at this point.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #11781 
Closes #11813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant