Bug 159356 - [zfs] [patch] ZFS NAME_ERR_DISKLIKE check is Solaris-specific
Summary: [zfs] [patch] ZFS NAME_ERR_DISKLIKE check is Solaris-specific
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 15:40 UTC by Robert Millan
Modified: 2021-06-11 14:06 UTC (History)
3 users (show)

See Also:


Attachments
file.txt (497 bytes, text/plain)
2011-08-01 15:40 UTC, Robert Millan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Millan 2011-08-01 15:40:13 UTC
NAME_ERR_DISKLIKE check in sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c prevents creating ZFS pools with names that ressemble Solaris device names.

This has no use on FreeBSD and derivatives like Debian GNU/kFreeBSD, please consider #ifdef'ing this check out.

Fix: Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-08-05 02:33:06 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:55 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Dennis Clarke 2021-03-23 03:15:47 UTC
This is still a concern with OpenZFS in that:

 sys/contrib/openzfs/module/zcommon/zfs_namecheck.c  

still looks like : 

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

Surely this can be changed to looking for ada0 or even da0 type stuff?


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
Comment 4 Dennis Clarke 2021-03-23 03:58:11 UTC
I filed an "issue" upstream :

    https://github.com/openzfs/zfs/issues/11781

Perhaps for now we could comment out this old historical 
error condition.
Comment 5 Dennis Clarke 2021-03-24 02:38:10 UTC
Trivial and tested.
Comment 6 Dennis Clarke 2021-03-24 23:44:08 UTC
I have no idea how to create anything in the mystery site that is 
running phabricator.  This thing --> https://reviews.freebsd.org/ .

Therefore I have a real barrier to entry to do anything there.

europa# uname -apKU 
FreeBSD europa 14.0-CURRENT FreeBSD 14.0-CURRENT #2: Tue Mar 23 10:32:37 GMT 2021     root@europa:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64 amd64 1400006 1400006

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#

So there is no issue with a pool name that begins with "c[0-9".
 
europa# 
europa# zpool destroy c0ffee
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.
Comment 7 Dennis Clarke 2021-03-28 23:45:54 UTC
Seems to be a done deal : 

https://github.com/freqlabs/ZoF/commit/f04718fe3eb0269fba6a0d8c0bae4e0f08d7bd7c

Dennis Clarke
Comment 8 Ryan Moeller freebsd_committer freebsd_triage 2021-03-29 16:39:59 UTC
https://github.com/openzfs/zfs/pull/11813
Comment 9 Dennis Clarke 2021-04-01 23:02:42 UTC
Based on https://github.com/openzfs/zfs/pull/11813 and also the code
change https://github.com/openzfs/zfs/commit/c05eec32a7f7eeeb17c328f39da742a8096a5991

May we close this ten year old bug ? 

Dennis
Comment 10 Dennis Clarke 2021-04-08 03:27:03 UTC
A change was pushed about six hours ago and I did check the master
upstream sources where I see that the zpool name check for the leading
chars 'c[0-9' has been removed. 

See https://github.com/openzfs/zfs/commit/895d39aa832a6d90cb15263f8bbe41509baa3867


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
Comment 11 Ryan Moeller freebsd_committer freebsd_triage 2021-06-11 14:06:01 UTC
Fixed by https://reviews.freebsd.org/D29419
R10:895d39aa832a: Allow pool names that look like Solaris disk names
R10:c05eec32a7f7: Allow pool names that look like Solaris disk names