Date: Tue, 29 Mar 2022 17:43:34 +0200 From: Martin Matuska <mm@FreeBSD.org> To: Rob Wing <rob.fx907@gmail.com> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 99c3f1577459 - releng/13.1 - zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) into stable/13 Message-ID: <0712c3eb-0a36-c3f0-a8da-aef99a0cb363@FreeBSD.org> In-Reply-To: <CAF3%2Bn_e%2BM=3K6EMcN6XJvpC3f8cuSFbM25dqY=xthpzdDy%2B-yw@mail.gmail.com> References: <202203291353.22TDr3cf008660@gitrepo.freebsd.org> <CAF3%2Bn_e%2BM=3K6EMcN6XJvpC3f8cuSFbM25dqY=xthpzdDy%2B-yw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------T225G4Nw6RIGdwrkSz1AebTw Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Looks like nobody proposed the commit for zfs-2.1-release at OpenZFS I am going to cherry-pick it to stable/13 Cheers, mm On 29. 3. 2022 17:41, Rob Wing wrote: > Martin, > > Is there any reason not to cherry-pick this commit in:=20 > https://github.com/openzfs/zfs/commit/4a1195ca5041cbff2a6b025a31937fef8= 4876c52? > > I bring it up because a few users have expressed interest in it.=20 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260160 > > > On Tue, Mar 29, 2022 at 5:53 AM Martin Matuska <mm@freebsd.org> wrote: > > The branch releng/13.1 has been updated by mm: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D99c3f15774595c1163ecec87a= a8cb157ccdc7d96 > <https://cgit.FreeBSD.org/src/commit/?id=3D99c3f15774595c1163ecec87= aa8cb157ccdc7d96> > > commit 99c3f15774595c1163ecec87aa8cb157ccdc7d96 > Author:=C2=A0 =C2=A0 =C2=A0Martin Matuska <mm@FreeBSD.org> > AuthorDate: 2022-03-29 10:41:53 +0000 > Commit:=C2=A0 =C2=A0 =C2=A0Martin Matuska <mm@FreeBSD.org> > CommitDate: 2022-03-29 13:50:47 +0000 > > =C2=A0 =C2=A0 zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) in= to stable/13 > > =C2=A0 =C2=A0 OpenZFS release 2.1.4 > > =C2=A0 =C2=A0 Notable upstream pull request merges: > =C2=A0 =C2=A0 =C2=A0 #13219 FreeBSD: add missing replay check to an= assert in > zfs_xvattr_set > =C2=A0 =C2=A0 =C2=A0 #13220 module: freebsd: avoid a taking a destr= oyed lock in > zfs_zevent bits > =C2=A0 =C2=A0 =C2=A0 #13221 Fix ACL checks for NFS kernel server > > =C2=A0 =C2=A0 Obtained from:=C2=A0 OpenZFS > =C2=A0 =C2=A0 OpenZFS tag:=C2=A0 =C2=A0 zfs-2.1.4 > =C2=A0 =C2=A0 OpenZFS commit: 52bad4f23daaa5f827f802c8d05785a27b802= 75d > =C2=A0 =C2=A0 Relnotes:=C2=A0 =C2=A0 =C2=A0 =C2=A0yes > =C2=A0 =C2=A0 Approved by:=C2=A0 =C2=A0 re (gjb) > > =C2=A0 =C2=A0 (cherry picked from commit > c088e4d539e4cc947896a3b156646b831d932539) > --- > =C2=A0sys/conf/kern.pre.mk <http://kern.pre.mk> =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0|=C2=A0 =C2=A02 +- > =C2=A0sys/contrib/openzfs/META=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0= 4 +- > =C2=A0sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c=C2=A0 =C2=A0 =C2= =A0 =C2=A0| 179 > +++++++++++++++++++-- > =C2=A0sys/contrib/openzfs/cmd/zed/zed_disk_event.c=C2=A0 =C2=A0 =C2= =A0 =C2=A0|=C2=A0 10 ++ > =C2=A0.../openzfs/include/os/freebsd/spl/sys/Makefile.am |=C2=A0 =C2= =A01 - > =C2=A0.../openzfs/include/os/freebsd/spl/sys/cred.h=C2=A0 =C2=A0 =C2= =A0 | 136 > ++-------------- > =C2=A0.../openzfs/include/os/freebsd/spl/sys/kidmap.h=C2=A0 =C2=A0 = |=C2=A0 41 ----- > =C2=A0.../openzfs/include/os/freebsd/spl/sys/sid.h=C2=A0 =C2=A0 =C2= =A0 =C2=A0|=C2=A0 25 --- > =C2=A0.../include/os/linux/kernel/linux/simd_x86.h=C2=A0 =C2=A0 =C2= =A0 =C2=A0|=C2=A0 =C2=A04 +- > =C2=A0.../openzfs/include/os/linux/spl/sys/cred.h=C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A05 - > =C2=A0sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c=C2=A0 =C2=A0 =C2= =A0|=C2=A0 =C2=A01 - > =C2=A0.../lib/libzutil/os/linux/zutil_device_path_os.c=C2=A0 =C2=A0= |=C2=A0 28 ++-- > =C2=A0sys/contrib/openzfs/module/Makefile.bsd=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +- > =C2=A0.../openzfs/module/os/freebsd/spl/spl_sysevent.c=C2=A0 =C2=A0= |=C2=A0 12 +- > =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_acl.c=C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A06 +- > =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c=C2=A0 =C2=A0= |=C2=A0 19 +-- > =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_znode.c=C2=A0 =C2=A0 =C2= =A0 |=C2=A0 =C2=A04 +- > =C2=A0sys/contrib/openzfs/module/os/linux/spl/spl-cred.c |=C2=A0 42= +---- > =C2=A0sys/contrib/openzfs/module/os/linux/zfs/policy.c=C2=A0 =C2=A0= |=C2=A0 10 +- > =C2=A0.../openzfs/module/os/linux/zfs/zpl_inode.c=C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A04 +- > =C2=A0.../openzfs/module/os/linux/zfs/zpl_xattr.c=C2=A0 =C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A04 +- > =C2=A0sys/contrib/openzfs/module/zfs/arc.c=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A02 +- > =C2=A0sys/modules/zfs/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0= 2 +- > =C2=A0sys/modules/zfs/zfs_config.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A08 +- > =C2=A0sys/modules/zfs/zfs_gitrev.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A03 +- > =C2=A025 files changed, 242 insertions(+), 312 deletions(-) > > diff --git a/sys/conf/kern.pre.mk <http://kern.pre.mk> > b/sys/conf/kern.pre.mk <http://kern.pre.mk> > index d6ab5e17a82a..6be49642b04e 100644 > --- a/sys/conf/kern.pre.mk <http://kern.pre.mk> > +++ b/sys/conf/kern.pre.mk <http://kern.pre.mk> > @@ -262,7 +262,7 @@ CDDL_C=3D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0${CC} -c ${CDDL_CFLAGS} > ${WERROR} ${PROF} ${.IMPSRC} > =C2=A0# Special flags for managing the compat compiles for ZFS > =C2=A0ZFS_CFLAGS+=3D=C2=A0 =C2=A0${CDDL_CFLAGS} -DBUILDING_ZFS -DHA= VE_UIO_ZEROCOPY \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 -DWITH_NETDUMP -D__KERNEL__ -D_SYS_COND= VAR_H_ -DSMP \ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0-DIN_FREEBSD_BASE -DHAVE_KSID > +=C2=A0 =C2=A0 =C2=A0 =C2=A0-DIN_FREEBSD_BASE > > =C2=A0.if ${MACHINE_ARCH} =3D=3D "amd64" > =C2=A0ZFS_CFLAGS+=3D -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 > -DHAVE_AVX512F \ > diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META > index 0437224b403f..76e59a42074c 100644 > --- a/sys/contrib/openzfs/META > +++ b/sys/contrib/openzfs/META > @@ -1,10 +1,10 @@ > =C2=A0Meta:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1 > =C2=A0Name:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs > =C2=A0Branch:=C2=A0 =C2=A0 =C2=A0 =C2=A0 1.0 > -Version:=C2=A0 =C2=A0 =C2=A0 =C2=A02.1.3 > +Version:=C2=A0 =C2=A0 =C2=A0 =C2=A02.1.4 > =C2=A0Release:=C2=A0 =C2=A0 =C2=A0 =C2=A01 > =C2=A0Release-Tags:=C2=A0 relext > =C2=A0License:=C2=A0 =C2=A0 =C2=A0 =C2=A0CDDL > =C2=A0Author:=C2=A0 =C2=A0 =C2=A0 =C2=A0 OpenZFS > -Linux-Maximum: 5.16 > +Linux-Maximum: 5.17 > =C2=A0Linux-Minimum: 3.10 > diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c > b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c > index 3bcdf6e1d718..a510d646e1f9 100644 > --- a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c > +++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c > @@ -183,14 +183,14 @@ zfs_process_add(zpool_handle_t *zhp, > nvlist_t *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 nvlist_t *nvroot, *newvd; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 pendingdev_t *device; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t wholedisk =3D 0ULL; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t offline =3D 0ULL; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t offline =3D 0ULL, faulted =3D = 0ULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t guid =3D 0ULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *physpath =3D NULL, *new_devid =3D= NULL, *enc_sysfs_path > =3D NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char rawpath[PATH_MAX], fullpath[PATH_M= AX]; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char devpath[PATH_MAX]; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 int ret; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_dm =3D B_FALSE; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t is_sd =3D B_FALSE; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_mpath_wholedisk =3D B_FALS= E; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint_t c; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdev_stat_t *vs; > > @@ -211,15 +211,73 @@ zfs_process_add(zpool_handle_t *zhp, > nvlist_t *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &enc_sysfs_path); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, ZPOOL= _CONFIG_WHOLE_DISK, > &wholedisk); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, ZPOOL= _CONFIG_OFFLINE, > &offline); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0(void) nvlist_lookup_uint64(vdev, ZPOOL= _CONFIG_FAULTED, > &faulted); > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, ZPOOL= _CONFIG_GUID, &guid); > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (offline) > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return;=C2=A0= /* don't intervene if it was taken offline */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Special case: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We've seen times where a disk won't = have a > ZPOOL_CONFIG_PHYS_PATH > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * entry in their config. For example, = on this > force-faulted disk: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 children[0]: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0typ= e: 'disk' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id:= 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0gui= d: 14309659774640089719 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 path: '/d= ev/disk/by-vdev/L28' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 whole_dis= k: 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 DTL: 654 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 create_tx= g: 4 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 com.delph= ix:vdev_zap_leaf: 1161 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 faulted: = 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 aux_state= : 'external' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 children[1]: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 type: 'di= sk' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 id: 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 guid: 160= 02508084177980912 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 path: '/d= ev/disk/by-vdev/L29' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 devid: 'd= m-uuid-mpath-35000c500a61d68a3' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 phys_path= : 'L29' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 vdev_enc_= sysfs_path: > '/sys/class/enclosure/0:0:1:0/SLOT 30 32' > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 whole_dis= k: 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 DTL: 1028 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 create_tx= g: 4 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 com.delph= ix:vdev_zap_leaf: 131 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * If the disk's path is a /dev/disk/by= -vdev/ path, then > we can infer > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * the ZPOOL_CONFIG_PHYS_PATH from the = by-vdev disk name. > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (physpath =3D=3D NULL && path !=3D N= ULL) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If path = begins with "/dev/disk/by-vdev/" ... */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (strncmp= (path, DEV_BYVDEV_PATH, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0strlen(DEV_BYVDEV_PATH)) =3D=3D 0) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0/* Set physpath to the char after > "/dev/disk/by-vdev" */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0physpath =3D &path[strlen(DEV_BYVDEV_PATH)]; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We don't want to autoreplace offline= d disks. However, > we do want to > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * replace force-faulted disks (`zpool = offline -f`). > Force-faulted > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * disks have both offline=3D1 and faul= ted=3D1 in the nvlist. > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (offline && !faulted) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, "%s: %s is offline, skip > autoreplace", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0__func__, path); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0is_dm =3D zfs_dev_is_dm(path); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0is_mpath_wholedisk =3D is_mpath_whole_d= isk(path); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log_msg(LOG_INFO, "zfs_process_add:= pool '%s' vdev > '%s', phys '%s'" > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" wholedisk %d, %s dm (gu= id %llu)", > zpool_get_name(zhp), path, > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0physpath ? physpath : "NU= LL", wholedisk, is_dm ? "is" > : "not", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" %s blank disk, %s mpath= blank disk, %s labeled, enc > sysfs '%s', " > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"(guid %llu)", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zpool_get_name(zhp), path= , > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0physpath ? physpath : "NU= LL", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wholedisk ? "is" : "not", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_mpath_wholedisk? "is" = : "not", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0labeled ? "is" : "not", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enc_sysfs_path, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (long long unsigned int)g= uid); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* > @@ -253,8 +311,9 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t > *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ZFS_ONLINE_CHECKREMOVE | = ZFS_ONLINE_UNSPARE, > &newstate) =3D=3D 0 && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (newstate =3D=3D VDEV_STA= TE_HEALTHY || > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 newstate =3D=3D VDEV_STAT= E_DEGRADED)) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, "=C2=A0 zpool_vdev_online: vdev > %s is %s", > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0fullpath, (newstate =3D=3D VDEV_STATE_HEALTHY) ? > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"=C2=A0 zpool_vdev_online: vdev '%s' ('%s') is " > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"%s", fullpath, physpath, (newstate =3D=3D > VDEV_STATE_HEALTHY) ? > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= "HEALTHY" : "DEGRADED"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > @@ -271,11 +330,12 @@ zfs_process_add(zpool_handle_t *zhp, > nvlist_t *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* vdev online to trigger a FMA fa= ult by posting an ereport. > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!zpool_get_prop_int(zhp, ZPOOL_PROP= _AUTOREPLACE, NULL) || > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!(wholedisk || is_dm) || = (physpath =3D=3D NULL)) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!(wholedisk || is_mpath_w= holedisk) || (physpath =3D=3D > NULL)) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) zpoo= l_vdev_online(zhp, fullpath, > ZFS_ONLINE_FORCEFAULT, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= &newstate); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log_msg= (LOG_INFO, "Pool's autoreplace is not > enabled or " > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"not a whole disk for '%s'", fullpath); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"not a blank disk for '%s' ('%s')", fullpath, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0physpath); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > @@ -287,7 +347,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t > *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) snprintf(rawpath, sizeof (rawpat= h), "%s%s", > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 is_sd ? DEV_BYVDEV_PATH := DEV_BYPATH_PATH, physpath); > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (realpath(rawpath, devpath) =3D=3D N= ULL && !is_dm) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (realpath(rawpath, devpath) =3D=3D N= ULL && > !is_mpath_wholedisk) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log_msg= (LOG_INFO, "=C2=A0 realpath: %s failed (%s)", > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= rawpath, strerror(errno)); > > @@ -303,12 +363,14 @@ zfs_process_add(zpool_handle_t *zhp, > nvlist_t *vdev, boolean_t labeled) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((vs->vs_state !=3D VDEV_STATE_DEGRA= DED) && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vs->vs_state !=3D VDEV_S= TATE_FAULTED) && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vs->vs_state !=3D VDEV_S= TATE_CANT_OPEN)) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, "=C2=A0 not autoreplacing since > disk isn't in " > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"a bad state (currently %d)", vs->vs_state); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 nvlist_lookup_string(vdev, "new_devid",= &new_devid); > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_dm) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_mpath_wholedisk) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Don't la= bel device mapper or multipath disks. */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (!labeled) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* > @@ -522,8 +584,11 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t > *nvl, void *data) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* the= dp->dd_compare value. > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (nvlist_= lookup_string(nvl, dp->dd_prop, &path) > !=3D 0 || > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0strcmp(dp->dd_compare, path) !=3D 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0strcmp(dp->dd_compare, path) !=3D 0) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO, "=C2=A0 %s: no match (%s > !=3D vdev %s)", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__, dp->dd_compare, path); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 return; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log_msg= (LOG_INFO, "=C2=A0 zfs_iter_vdev: matched %s > on %s", > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= dp->dd_prop, path); > @@ -571,6 +636,8 @@ zfs_iter_pool(zpool_handle_t *zhp, void *data) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 ZPOOL_CONFIG_VDEV_TREE, &nvl); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 zfs_iter_vdev(zhp, nvl, data); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} else { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, "%s: no config\n", __func__); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* > @@ -619,6 +686,72 @@ devphys_iter(const char *physical, const char > *devid, zfs_process_func_t func, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (data.dd_found); > =C2=A0} > > +/* > + * Given a device identifier, find any vdevs with a matching by-vd= ev > + * path.=C2=A0 Normally we shouldn't need this as the comparison w= ould be > + * made earlier in the devphys_iter().=C2=A0 For example, if we we= re > replacing > + * /dev/disk/by-vdev/L28, normally devphys_iter() would match the > + * ZPOOL_CONFIG_PHYS_PATH of "L28" from the old disk config to "L2= 8" > + * of the new disk config.=C2=A0 However, we've seen cases where > + * ZPOOL_CONFIG_PHYS_PATH was not in the config for the old > disk.=C2=A0 Here's > + * an example of a real 2-disk mirror pool where one disk was forc= e > + * faulted: > + * > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0com.delphix:vdev_zap_top: 129 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0children[0]: > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0type: 'di= sk' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id: 0 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0guid: 143= 09659774640089719 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0path: '/d= ev/disk/by-vdev/L28' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whole_dis= k: 0 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DTL: 654 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0create_tx= g: 4 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0com.delph= ix:vdev_zap_leaf: 1161 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0faulted: = 1 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0aux_state= : 'external' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0children[1]: > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0type: 'di= sk' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id: 1 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0guid: 160= 02508084177980912 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0path: '/d= ev/disk/by-vdev/L29' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0devid: 'd= m-uuid-mpath-35000c500a61d68a3' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0phys_path= : 'L29' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vdev_enc_= sysfs_path: > '/sys/class/enclosure/0:0:1:0/SLOT 30 32' > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whole_dis= k: 0 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DTL: 1028 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0create_tx= g: 4 > + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0com.delph= ix:vdev_zap_leaf: 131 > + * > + * So in the case above, the only thing we could compare is the pa= th. > + * > + * We can do this because we assume by-vdev paths are > authoritative as physical > + * paths.=C2=A0 We could not assume this for normal paths like > /dev/sda since the > + * physical location /dev/sda points to could change over time. > + */ > +static boolean_t > +by_vdev_path_iter(const char *by_vdev_path, const char *devid, > +=C2=A0 =C2=A0 zfs_process_func_t func, boolean_t is_slice) > +{ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dev_data_t data =3D { 0 }; > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_compare =3D by_vdev_path; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_func =3D func; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_prop =3D ZPOOL_CONFIG_PATH; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_found =3D B_FALSE; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_islabeled =3D is_slice; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_new_devid =3D devid; > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (strncmp(by_vdev_path, DEV_BYVDEV_PA= TH, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0strlen(DEV_BYVDEV_PATH)) = !=3D 0) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* by_vdev_= path doesn't start with > "/dev/disk/by-vdev/" */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (B_F= ALSE); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0(void) zpool_iter(g_zfshdl, zfs_iter_po= ol, &data); > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (data.dd_found); > +} > + > =C2=A0/* > =C2=A0 * Given a device identifier, find any vdevs with a matching = devid. > =C2=A0 * On Linux we can match devid directly which is always a who= le disk. > @@ -683,15 +816,17 @@ guid_iter(uint64_t pool_guid, uint64_t > vdev_guid, const char *devid, > =C2=A0static int > =C2=A0zfs_deliver_add(nvlist_t *nvl, boolean_t is_lofi) > =C2=A0{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0char *devpath =3D NULL, *devid; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0char *devpath =3D NULL, *devid =3D NULL= ; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t pool_guid =3D 0, vdev_guid =3D= 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t is_slice; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Expecting a devid string and an= optional physical > location and guid > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (nvlist_lookup_string(nvl, DEV_IDENT= IFIER, &devid) !=3D 0) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (nvlist_lookup_string(nvl, DEV_IDENT= IFIER, &devid) !=3D 0) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log_msg= (LOG_INFO, "%s: no dev identifier\n", > __func__); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (-1)= ; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_string(nvl, DEV_PH= YS_PATH, &devpath); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(nvl, ZFS_EV= _POOL_GUID, > &pool_guid); > @@ -707,6 +842,8 @@ zfs_deliver_add(nvlist_t *nvl, boolean_t is_lof= i) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 1. ZPOOL_CONFIG_DEVID (identifi= es the unique disk) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 2. ZPOOL_CONFIG_PHYS_PATH (iden= tifies disk physical > location). > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 3. ZPOOL_CONFIG_GUID (identifie= s unique vdev). > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * 4. ZPOOL_CONFIG_PATH for /dev/disk/b= y-vdev devices only > (since > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 by-vdev paths represent= physical paths). > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (devid_iter(devid, zfs_process_add, = is_slice)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); > @@ -717,6 +854,16 @@ zfs_deliver_add(nvlist_t *nvl, boolean_t is_lo= fi) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) guid= _iter(pool_guid, vdev_guid, devid, > zfs_process_add, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= is_slice); > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (devpath !=3D NULL) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Can we m= atch a /dev/disk/by-vdev/ path? */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char by_vde= v_path[MAXPATHLEN]; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0snprintf(by= _vdev_path, sizeof (by_vdev_path), > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"/dev/disk/by-vdev/%s", devpath); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (by_vdev= _path_iter(by_vdev_path, devid, > zfs_process_add, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0is_slice)) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0return (0); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); > =C2=A0} > > diff --git a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c > b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c > index 94e24236063c..52b80d8c4c93 100644 > --- a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c > +++ b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c > @@ -215,6 +215,11 @@ zed_udev_monitor(void *arg) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (type !=3D= NULL && type[0] !=3D '\0' && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= strcmp(type, "disk") =3D=3D 0 && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= part !=3D NULL && part[0] !=3D '\0') { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s: skip %s since it has a %s > partition already", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__, > + =C2=A0udev_device_get_property_value(dev, "DEVNAME"), > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0part); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 /* skip and wait for partition event */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 udev_device_unref(dev); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 continue; > @@ -229,6 +234,11 @@ zed_udev_monitor(void *arg) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 sectors =3D > udev_device_get_sysattr_value(dev, "size"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (sectors= !=3D NULL && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= strtoull(sectors, NULL, 10) < MINIMUM_SECTORS) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s: %s sectors %s < %llu (minimum)", > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__, > + =C2=A0udev_device_get_property_value(dev, "DEVNAME"), > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sectors, MINIMUM_SECTORS); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 udev_device_unref(dev); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 continue; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > diff --git > a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am > b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am > index 232aaf569fa2..7488e56c7649 100644 > --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am > +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am > @@ -22,7 +22,6 @@ KERNEL_H =3D \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 inttypes.h \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 isa_defs.h \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem_cache.h \ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0kidmap.h \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem.h \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kstat.h \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 list_impl.h \ > diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h > b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h > index 86f79011d6da..db986af57bf5 100644 > --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h > +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h > @@ -48,138 +48,20 @@ extern "C" { > =C2=A0typedef struct ucred cred_t; > > =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CRED()=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 curthread->td_ucred > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kcred=C2=A0 =C2=A0(thread0.td_u= cred) > - > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KUID_TO_SUID(x)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(x) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KGID_TO_SGID(x)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(x) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetuid(cred)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ((cred)->cr_uid) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetruid(cred)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0((cred)->cr_ruid) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgid(cred)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ((cred)->cr_gid) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgroups(cred)=C2=A0 =C2=A0 = =C2=A0 =C2=A0((cred)->cr_groups) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetngroups(cred) ((cred)->cr_= ngroups) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetsid(cred, i)=C2=A0 =C2=A0 = =C2=A0 =C2=A0(NULL) > > -struct proc;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* cred.h is included in > proc.h */ > -struct prcred; > -struct ksid; > -struct ksidlist; > -struct credklpd; > -struct credgrp; > - > -struct auditinfo_addr;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0/* cred.h is included in > audit.h */ > - > -extern int ngroups_max; > =C2=A0/* > =C2=A0 * kcred is used when you need all privileges. > =C2=A0 */ > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kcred=C2=A0 =C2=A0(thread0.td_u= cred) > > -extern void cred_init(void); > -extern void crfree(cred_t *); > -extern cred_t *cralloc(void);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*= all but ref > uninitialized */ > -extern cred_t *cralloc_ksid(void);=C2=A0 =C2=A0 =C2=A0/* cralloc()= + ksid > alloc'ed */ > -extern cred_t *crget(void);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= /* initialized */ > -extern void crcopy_to(cred_t *, cred_t *); > -extern cred_t *crdup(cred_t *); > -extern void crdup_to(cred_t *, cred_t *); > -extern cred_t *crgetcred(void); > -extern void crset(struct proc *, cred_t *); > -extern void crset_zone_privall(cred_t *); > -extern int supgroupmember(gid_t, const cred_t *); > -extern int hasprocperm(const cred_t *, const cred_t *); > -extern int prochasprocperm(struct proc *, struct proc *, const > cred_t *); > -extern int crcmp(const cred_t *, const cred_t *); > -extern cred_t *zone_kcred(void); > - > -extern gid_t crgetrgid(const cred_t *); > -extern gid_t crgetsgid(const cred_t *); > - > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetzoneid(cr) ((cr)->cr_priso= n->pr_id) > -extern projid_t crgetprojid(const cred_t *); > - > -extern cred_t *crgetmapped(const cred_t *); > - > - > -extern const struct auditinfo_addr *crgetauinfo(const cred_t *); > -extern struct auditinfo_addr *crgetauinfo_modifiable(cred_t *); > - > -extern uint_t crgetref(const cred_t *); > - > -extern const gid_t *crgetggroups(const struct credgrp *); > - > - > -/* > - * Sets real, effective and/or saved uid/gid; > - * -1 argument accepted as "no change". > - */ > -extern int crsetresuid(cred_t *, uid_t, uid_t, uid_t); > -extern int crsetresgid(cred_t *, gid_t, gid_t, gid_t); > - > -/* > - * Sets real, effective and saved uids/gids all to the same > - * values.=C2=A0 Both values must be non-negative and <=3D MAXUID > - */ > -extern int crsetugid(cred_t *, uid_t, gid_t); > - > -/* > - * Functions to handle the supplemental group list. > - */ > -extern struct credgrp *crgrpcopyin(int, gid_t *); > -extern void crgrprele(struct credgrp *); > -extern void crsetcredgrp(cred_t *, struct credgrp *); > - > -/* > - * Private interface for setting zone association of credential. > - */ > -struct zone; > -extern void crsetzone(cred_t *, struct zone *); > -extern struct zone *crgetzone(const cred_t *); > - > -/* > - * Private interface for setting project id in credential. > - */ > -extern void crsetprojid(cred_t *, projid_t); > - > -/* > - * Private interface for nfs. > - */ > -extern cred_t *crnetadjust(cred_t *); > - > -/* > - * Private interface for procfs. > - */ > -extern void cred2prcred(const cred_t *, struct prcred *); > - > -/* > - * Private interfaces for Rampart Trusted Solaris. > - */ > -struct ts_label_s; > -extern struct ts_label_s *crgetlabel(const cred_t *); > -extern boolean_t crisremote(const cred_t *); > - > -/* > - * Private interfaces for ephemeral uids. > - */ > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 VALID_UID(id, zn) =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0\ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0((id) <=3D MAXUID || valid_ephemeral_ui= d((zn), (id))) > - > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 VALID_GID(id, zn) =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0\ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0((id) <=3D MAXUID || valid_ephemeral_gi= d((zn), (id))) > - > -extern boolean_t valid_ephemeral_uid(struct zone *, uid_t); > -extern boolean_t valid_ephemeral_gid(struct zone *, gid_t); > - > -extern int eph_uid_alloc(struct zone *, int, uid_t *, int); > -extern int eph_gid_alloc(struct zone *, int, gid_t *, int); > - > -extern void crsetsid(cred_t *, struct ksid *, int); > -extern void crsetsidlist(cred_t *, struct ksidlist *); > - > -extern struct ksidlist *crgetsidlist(const cred_t *); > - > -extern int crsetpriv(cred_t *, ...); > - > -extern struct credklpd *crgetcrklpd(const cred_t *); > -extern void crsetcrklpd(cred_t *, struct credklpd *); > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KUID_TO_SUID(x)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(x) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KGID_TO_SGID(x)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(x) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetuid(cr)=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 ((cr)->cr_uid) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetruid(cr)=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0((cr)->cr_ruid) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgid(cr)=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 ((cr)->cr_gid) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgroups(cr)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0((cr)->cr_groups) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetngroups(cr)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 ((cr)->cr_ngroups) > +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetzoneid(cr) =C2=A0((cr)->cr= _prison->pr_id) > > =C2=A0#ifdef __cplusplus > =C2=A0} > diff --git > a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h > b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h > deleted file mode 100644 > index dc0cf5988a42..000000000000 > --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h > +++ /dev/null > @@ -1,41 +0,0 @@ > -/* > - * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> > - * All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or with= out > - * modification, are permitted provided that the following conditi= ons > - * are met: > - * 1. Redistributions of source code must retain the above copyrig= ht > - *=C2=A0 =C2=A0 notice, this list of conditions and the following = disclaimer. > - * 2. Redistributions in binary form must reproduce the above > copyright > - *=C2=A0 =C2=A0 notice, this list of conditions and the following > disclaimer in the > - *=C2=A0 =C2=A0 documentation and/or other materials provided with= the > distribution. > - * > - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS > IS'' AND > - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > TO, THE > - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > - * ARE DISCLAIMED.=C2=A0 IN NO EVENT SHALL THE AUTHORS OR CONTRIBU= TORS > BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS > - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING > IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > - * SUCH DAMAGE. > - * > - * $FreeBSD$ > - */ > - > -#ifndef _OPENSOLARIS_SYS_KIDMAP_H_ > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _OPENSOLARIS_SYS_KIDMAP_H_ > - > -#include <sys/idmap.h> > - > -typedef int32_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 idmap_stat; > -typedef void=C2=A0 =C2=A0idmap_get_handle_t; > - > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_create()=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(NULL) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_destroy(hdl)=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0do { } while (0) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_mappings(hdl)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 (NULL) > - > -#endif /* _OPENSOLARIS_SYS_KIDMAP_H_ */ > diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h > b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h > index d3fab8b24744..f249d05d55a0 100644 > --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h > +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h > @@ -29,7 +29,6 @@ > =C2=A0#ifndef _OPENSOLARIS_SYS_SID_H_ > =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _OPENSOLARIS_SYS_SID_H_ > =C2=A0#include <sys/idmap.h> > -#include <sys/kidmap.h> > > =C2=A0typedef struct ksiddomain { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char=C2=A0 =C2=A0 *kd_name;=C2=A0 =C2=A0= =C2=A0 =C2=A0/* Domain part of SID */ > @@ -59,28 +58,4 @@ ksiddomain_rele(ksiddomain_t *kd) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem_free(kd, sizeof (*kd)); > =C2=A0} > > -static __inline uint_t > -ksid_getid(ksid_t *ks) > -{ > - > -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly called"= , __func__); > -} > - > -static __inline const char * > -ksid_getdomain(ksid_t *ks) > -{ > - > -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly called"= , __func__); > -} > - > -static __inline uint_t > -ksid_getrid(ksid_t *ks) > -{ > - > -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly called"= , __func__); > -} > - > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_getsidbyuid(zone, uid, s= id_prefix, rid)=C2=A0 (1) > -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_getsidbygid(zone, gid, s= id_prefix, rid)=C2=A0 (1) > - > =C2=A0#endif /* _OPENSOLARIS_SYS_SID_H_ */ > diff --git > a/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h > b/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h > index 6d4c7a09fe82..0f6a222ba667 100644 > --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h > +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h > @@ -420,9 +420,9 @@ kfpu_end(void) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (static_cpu_has(X86_FEATURE_XSAVE)) = { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfpu_do_xrs= tor("xrstor", &state->xsave, ~0); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (static_cpu_has(X86_FEATURE_F= XSR)) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_save_f= xsr(&state->fxsave); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_restor= e_fxsr(&state->fxsave); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_save_f= save(&state->fsave); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_restor= e_fsave(&state->fsave); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0out: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 local_irq_enable(); > diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h > b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h > index 9cc85deb5c8a..b7d3f38d70bb 100644 > --- a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h > +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h > @@ -49,12 +49,7 @@ extern void crhold(cred_t *cr); > =C2=A0extern void crfree(cred_t *cr); > =C2=A0extern uid_t crgetuid(const cred_t *cr); > =C2=A0extern uid_t crgetruid(const cred_t *cr); > -extern uid_t crgetsuid(const cred_t *cr); > -extern uid_t crgetfsuid(const cred_t *cr); > =C2=A0extern gid_t crgetgid(const cred_t *cr); > -extern gid_t crgetrgid(const cred_t *cr); > -extern gid_t crgetsgid(const cred_t *cr); > -extern gid_t crgetfsgid(const cred_t *cr); > =C2=A0extern int crgetngroups(const cred_t *cr); > =C2=A0extern gid_t *crgetgroups(const cred_t *cr); > =C2=A0extern int groupmember(gid_t gid, const cred_t *cr); > diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c > b/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c > index 644dd26859f1..f77becd6a5c1 100644 > --- a/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c > +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c > @@ -606,7 +606,6 @@ get_key_material_https(libzfs_handle_t *hdl, > const char *uri, > =C2=A0kfdok: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((key =3D fdopen(kfd, "r+")) =3D=3D = NULL) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D err= no; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0free(path); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) clos= e(kfd); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_error_a= ux(hdl, dgettext(TEXT_DOMAIN, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= "Couldn't reopen temporary file: %s"), > strerror(ret)); > diff --git > a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c > b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c > index 13f8bd031612..45a6f6f5935b 100644 > --- a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_o= s.c > +++ b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_o= s.c > @@ -527,7 +527,7 @@ zfs_dev_is_dm(const char *dev_name) > =C2=A0boolean_t > =C2=A0zfs_dev_is_whole_disk(const char *dev_name) > =C2=A0{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0struct dk_gpt *label; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0struct dk_gpt *label =3D NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 int fd; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((fd =3D open(dev_name, O_RDONLY | O= _DIRECT | O_CLOEXEC)) > < 0) > @@ -613,22 +613,24 @@ zfs_get_underlying_path(const char *dev_name) > =C2=A0/* > =C2=A0 * A disk is considered a multipath whole disk when: > =C2=A0 *=C2=A0 =C2=A0 =C2=A0DEVNAME key value has "dm-" > - *=C2=A0 =C2=A0 =C2=A0DM_NAME key value has "mpath" prefix > - *=C2=A0 =C2=A0 =C2=A0DM_UUID key exists > + *=C2=A0 =C2=A0 =C2=A0DM_UUID key exists and starts with 'mpath-' > =C2=A0 *=C2=A0 =C2=A0 =C2=A0ID_PART_TABLE_TYPE key does not exist o= r is not gpt > + *=C2=A0 =C2=A0 =C2=A0ID_FS_LABEL key does not exist (disk isn't l= abeled) > =C2=A0 */ > =C2=A0static boolean_t > -udev_mpath_whole_disk(struct udev_device *dev) > +is_mpath_udev_sane(struct udev_device *dev) > =C2=A0{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0const char *devname, *type, *uuid; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0const char *devname, *type, *uuid, *lab= el; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 devname =3D udev_device_get_property_va= lue(dev, "DEVNAME"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 type =3D udev_device_get_property_value= (dev, > "ID_PART_TABLE_TYPE"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uuid =3D udev_device_get_property_value= (dev, "DM_UUID"); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0label =3D udev_device_get_property_valu= e(dev, "ID_FS_LABEL"); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((devname !=3D NULL && strncmp(devna= me, "/dev/dm-", 8) =3D=3D > 0) && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((type =3D=3D NULL) || (s= trcmp(type, "gpt") !=3D 0)) && > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(uuid !=3D NULL)) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((uuid !=3D NULL) && (str= ncmp(uuid, "mpath-", 6) =3D=3D 0)) && > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(label =3D=3D NULL)) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (B_T= RUE); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > @@ -636,7 +638,11 @@ udev_mpath_whole_disk(struct udev_device *dev) > =C2=A0} > > =C2=A0/* > - * Check if a disk is effectively a multipath whole disk > + * Check if a disk is a multipath "blank" disk: > + * > + * 1. The disk has udev values that suggest it's a multipath disk > + * 2. The disk is not currently labeled with a filesystem of any t= ype > + * 3. There are no partitions on the disk > =C2=A0 */ > =C2=A0boolean_t > =C2=A0is_mpath_whole_disk(const char *path) > @@ -645,7 +651,6 @@ is_mpath_whole_disk(const char *path) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct udev_device *dev =3D NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char nodepath[MAXPATHLEN]; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *sysname; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t wholedisk =3D B_FALSE; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (realpath(path, nodepath) =3D=3D NUL= L) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (B_F= ALSE); > @@ -660,10 +665,11 @@ is_mpath_whole_disk(const char *path) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (B_F= ALSE); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0wholedisk =3D udev_mpath_whole_disk(dev= ); > - > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Sanity check some udev values */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_sane =3D is_mpath_udev_san= e(dev); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 udev_device_unref(dev); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (wholedisk); > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (is_sane); > =C2=A0} > > =C2=A0#else /* HAVE_LIBUDEV */ > diff --git a/sys/contrib/openzfs/module/Makefile.bsd > b/sys/contrib/openzfs/module/Makefile.bsd > index 8aa4ed22275e..dc6cc2b74243 100644 > --- a/sys/contrib/openzfs/module/Makefile.bsd > +++ b/sys/contrib/openzfs/module/Makefile.bsd > @@ -32,7 +32,7 @@ CFLAGS+=3D -include > ${INCDIR}/os/freebsd/spl/sys/ccompile.h > > =C2=A0CFLAGS+=3D -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS > -D__BSD_VISIBLE=3D1 \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DHAVE_UIO_ZEROCOPY -DWITHOUT_NET= DUMP -D__KERNEL > -D_SYS_CONDVAR_H_ \ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -= DHAVE_KSID > -DCOMPAT_FREEBSD11 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -= DCOMPAT_FREEBSD11 > > =C2=A0.if ${MACHINE_ARCH} =3D=3D "amd64" > =C2=A0CFLAGS+=3D -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 > -DHAVE_AVX512F -DHAVE_SSSE3 > diff --git > a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c > b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c > index d5d50080fafd..16188c71b53d 100644 > --- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c > +++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c > @@ -250,7 +250,17 @@ sysevent_worker(void *arg __unused) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 nvlist_free(event); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > -=C2=A0 =C2=A0 =C2=A0 =C2=A0zfs_zevent_destroy(ze); > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We avoid zfs_zevent_destroy() here b= ecause we're > otherwise racing > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * against fm_fini() destroying the zev= ent_lock. > zfs_zevent_destroy() > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * will currently only clear `ze->ze_ze= vent` from an event > list then > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * free `ze`, so just inline the free()= here -- events > have already > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * been drained. > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0VERIFY3P(ze->ze_zevent, =3D=3D, NULL); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0kmem_free(ze, sizeof (zfs_zevent_t)); > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kthread_exit(); > =C2=A0} > > diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c > b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c > index ae758bcefe21..fe0f69132321 100644 > --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c > +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c > @@ -1653,8 +1653,10 @@ zfs_acl_ids_create(znode_t *dzp, int flag, > vattr_t *vap, cred_t *cr, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= ZFS_GROUP, &acl_ids->z_fuidp); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid =3D vap= ->va_gid; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0acl_ids->z_= fuid =3D zfs_fuid_create_cred(zfsvfs, > ZFS_OWNER, > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0cr, &acl_ids->z_fuidp); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t id =3D= crgetuid(cr); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (IS_EPHE= MERAL(id)) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0id =3D UID_NOBODY; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0acl_ids->z_= fuid =3D (uint64_t)id; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 acl_ids->z_= fgid =3D 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vap->va= _mask & AT_GID)=C2=A0 { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 acl_ids->z_fgid =3D zfs_fuid_create(zfsvfs, > diff --git > a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c > b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c > index 7bcf80bf5a94..b2cc3d063f9c 100644 > --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c > +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c > @@ -1060,8 +1060,7 @@ zfs_create(znode_t *dzp, const char *name, > vattr_t *vap, int excl, int mode, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 objset_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 *os= ; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 dmu_tx_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 *tx= ; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0error; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= *ksid; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0uid; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0uid =3D crgetuid(cr); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0gid =3D crgetgid(cr); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 pro= jid =3D ZFS_DEFAULT_PROJID; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_acl_ids_t=C2=A0 =C2=A0acl_ids; > @@ -1075,13 +1074,6 @@ zfs_create(znode_t *dzp, const char *name, > vattr_t *vap, int excl, int mode, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If we have an ephemeral id, ACL= , or XVATTR then > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* make sure file system is at pro= per version > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > - > -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid =3D crgetsid(cr, KSID_OWNER); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ksid) > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D ksi= d_getid(ksid); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0else > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D crg= etuid(cr); > - > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zfsvfs->z_use_fuids =3D=3D B_FALSE = && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vsecp || (vap->va_mask &= AT_XVATTR) || > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IS_EPHEMERAL(uid) || IS_E= PHEMERAL(gid))) > @@ -1415,8 +1407,7 @@ zfs_mkdir(znode_t *dzp, const char *dirname, > vattr_t *vap, znode_t **zpp, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 txt= ype; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 dmu_tx_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 *tx= ; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0error; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= *ksid; > -=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0uid; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0uid =3D crgetuid(cr); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0gid =3D crgetgid(cr); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_acl_ids_t=C2=A0 =C2=A0acl_ids; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t=C2=A0 =C2=A0 =C2=A0 =C2=A0fui= d_dirtied; > @@ -1427,12 +1418,6 @@ zfs_mkdir(znode_t *dzp, const char > *dirname, vattr_t *vap, znode_t **zpp, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If we have an ephemeral id, ACL= , or XVATTR then > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* make sure file system is at pro= per version > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > - > -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid =3D crgetsid(cr, KSID_OWNER); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ksid) > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D ksi= d_getid(ksid); > -=C2=A0 =C2=A0 =C2=A0 =C2=A0else > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D crg= etuid(cr); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zfsvfs->z_use_fuids =3D=3D B_FALSE = && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((vap->va_mask & AT_XVATT= R) || > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IS_EPHEMERAL(uid) || IS_E= PHEMERAL(gid))) > diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c > b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c > index d14df9d88a35..8a2773ac7971 100644 > --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c > +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c > @@ -839,7 +839,9 @@ zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, > dmu_tx_t *tx) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 xoap =3D xva_getxoptattr(xvap); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ASSERT3P(xoap, !=3D, NULL); > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0ASSERT_VOP_IN_SEQC(ZTOV(zp)); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (zp->z_zfsvfs->z_replay =3D=3D B_FAL= SE) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ASSERT_VOP_= IN_SEQC(ZTOV(zp)); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (XVA_ISSET_REQ(xvap, XAT_CREATETIME)= ) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t ti= mes[2]; > diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c > b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c > index 8fe1cc30ba99..f81b9540a639 100644 > --- a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c > +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c > @@ -128,7 +128,7 @@ groupmember(gid_t gid, const cred_t *cr) > =C2=A0uid_t > =C2=A0crgetuid(const cred_t *cr) > =C2=A0{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->euid)); > +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->fsuid)); > =C2=A0} > > =C2=A0/* Return the real user id */ > @@ -138,44 +138,9 @@ crgetruid(const cred_t *cr) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (KUID_TO_SUID(cr->uid)); > =C2=A0} > > -/* Return the saved user id */ > -uid_t > -crgetsuid(const cred_t *cr) > -{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->suid)); > -} > - > -/* Return the filesystem user id */ > -uid_t > -crgetfsuid(const cred_t *cr) > -{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->fsuid)); > -} > - > =C2=A0/* Return the effective group id */ > =C2=A0gid_t > =C2=A0crgetgid(const cred_t *cr) > -{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->egid)); > -} > - > -/* Return the real group id */ > -gid_t > -crgetrgid(const cred_t *cr) > -{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->gid)); > -} > - > -/* Return the saved group id */ > -gid_t > -crgetsgid(const cred_t *cr) > -{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->sgid)); > -} > - > -/* Return the filesystem group id */ > -gid_t > -crgetfsgid(const cred_t *cr) > =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (KGID_TO_SGID(cr->fsgid)); > =C2=A0} > @@ -184,12 +149,7 @@ EXPORT_SYMBOL(crhold); > =C2=A0EXPORT_SYMBOL(crfree); > =C2=A0EXPORT_SYMBOL(crgetuid); > =C2=A0EXPORT_SYMBOL(crgetruid); > -EXPORT_SYMBOL(crgetsuid); > -EXPORT_SYMBOL(crgetfsuid); > =C2=A0EXPORT_SYMBOL(crgetgid); > -EXPORT_SYMBOL(crgetrgid); > -EXPORT_SYMBOL(crgetsgid); > -EXPORT_SYMBOL(crgetfsgid); > =C2=A0EXPORT_SYMBOL(crgetngroups); > =C2=A0EXPORT_SYMBOL(crgetgroups); > =C2=A0EXPORT_SYMBOL(groupmember); > diff --git a/sys/contrib/openzfs/module/os/linux/zfs/policy.c > b/sys/contrib/openzfs/module/os/linux/zfs/policy.c > index bbccb2e572d9..5a52092bb90a 100644 > --- a/sys/contrib/openzfs/module/os/linux/zfs/policy.c > +++ b/sys/contrib/openzfs/module/os/linux/zfs/policy.c > @@ -121,7 +121,7 @@ secpolicy_vnode_access2(const cred_t *cr, > struct inode *ip, uid_t owner, > =C2=A0int > =C2=A0secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip= , > uid_t owner) > =C2=A0{ > -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (crgetfsuid(cr) =3D=3D owner) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (crgetuid(cr) =3D=3D owner) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zpl_inode_owner_or_capable(kcred->u= ser_ns, ip)) > @@ -147,7 +147,7 @@ secpolicy_vnode_any_access(const cred_t *cr, > struct inode *ip, uid_t owner) > =C2=A0int > =C2=A0secpolicy_vnode_chown(const cred_t *cr, uid_t owner) > *** 141 LINES SKIPPED *** > --------------T225G4Nw6RIGdwrkSz1AebTw Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF= -8"> </head> <body> <p>Looks like nobody proposed the commit for zfs-2.1-release at OpenZFS</p> <p>I am going to cherry-pick it to stable/13</p> <p>Cheers,<br> mm<br> </p> <div class=3D"moz-cite-prefix">On 29. 3. 2022 17:41, Rob Wing wrote:<= br> </div> <blockquote type=3D"cite" cite=3D"mid:CAF3+n_e+M=3D3K6EMcN6XJvpC3f8cuSFbM25dqY=3DxthpzdDy+-yw@mail.= gmail.com"> <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DU= TF-8"> <div dir=3D"ltr"> <div>Martin,</div> <div><br> </div> <div>Is there any reason not to cherry-pick this commit in: <a href=3D"https://github.com/openzfs/zfs/commit/4a1195ca5041cbff2a6b025a319= 37fef84876c52" moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">http= s://github.com/openzfs/zfs/commit/4a1195ca5041cbff2a6b025a31937fef84876c5= 2</a>?</div> <div><br> </div> <div>I bring it up because a few users have expressed interest in it. <a href=3D"https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D2= 60160" moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">http= s://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260160</a></div> <div><br> </div> </div> <br> <div class=3D"gmail_quote"> <div dir=3D"ltr" class=3D"gmail_attr">On Tue, Mar 29, 2022 at 5:5= 3 AM Martin Matuska <<a href=3D"mailto:mm@freebsd.org" moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">mm@f= reebsd.org</a>> wrote:<br> </div> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">= The branch releng/13.1 has been updated by mm:<br> <br> URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D99c3f15774595c1163ecec8= 7aa8cb157ccdc7d96" rel=3D"noreferrer" target=3D"_blank" moz-do-not-send=3D"true"= >https://cgit.FreeBSD.org/src/commit/?id=3D99c3f15774595c1163ecec87aa8cb1= 57ccdc7d96</a><br> <br> commit 99c3f15774595c1163ecec87aa8cb157ccdc7d96<br> Author:=C2=A0 =C2=A0 =C2=A0Martin Matuska <a class=3D"moz-txt-l= ink-rfc2396E" href=3D"mailto:mm@FreeBSD.org"><mm@FreeBSD.org></a><b= r> AuthorDate: 2022-03-29 10:41:53 +0000<br> Commit:=C2=A0 =C2=A0 =C2=A0Martin Matuska <a class=3D"moz-txt-l= ink-rfc2396E" href=3D"mailto:mm@FreeBSD.org"><mm@FreeBSD.org></a><b= r> CommitDate: 2022-03-29 13:50:47 +0000<br> <br> =C2=A0 =C2=A0 zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release= ) into stable/13<br> <br> =C2=A0 =C2=A0 OpenZFS release 2.1.4<br> <br> =C2=A0 =C2=A0 Notable upstream pull request merges:<br> =C2=A0 =C2=A0 =C2=A0 #13219 FreeBSD: add missing replay check t= o an assert in zfs_xvattr_set<br> =C2=A0 =C2=A0 =C2=A0 #13220 module: freebsd: avoid a taking a d= estroyed lock in zfs_zevent bits<br> =C2=A0 =C2=A0 =C2=A0 #13221 Fix ACL checks for NFS kernel serve= r<br> <br> =C2=A0 =C2=A0 Obtained from:=C2=A0 OpenZFS<br> =C2=A0 =C2=A0 OpenZFS tag:=C2=A0 =C2=A0 zfs-2.1.4<br> =C2=A0 =C2=A0 OpenZFS commit: 52bad4f23daaa5f827f802c8d05785a27= b80275d<br> =C2=A0 =C2=A0 Relnotes:=C2=A0 =C2=A0 =C2=A0 =C2=A0yes<br> =C2=A0 =C2=A0 Approved by:=C2=A0 =C2=A0 re (gjb)<br> <br> =C2=A0 =C2=A0 (cherry picked from commit c088e4d539e4cc947896a3b156646b831d932539)<br> ---<br> =C2=A0sys/conf/<a href=3D"http://kern.pre.mk" rel=3D"noreferrer= " target=3D"_blank" moz-do-not-send=3D"true">kern.pre.mk</a>=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A02 +-<br> =C2=A0sys/contrib/openzfs/META=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2= =A04 +-<br> =C2=A0sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c=C2=A0 =C2=A0= =C2=A0 =C2=A0| 179 +++++++++++++++++++--<br> =C2=A0sys/contrib/openzfs/cmd/zed/zed_disk_event.c=C2=A0 =C2=A0= =C2=A0 =C2=A0|=C2=A0 10 ++<br> =C2=A0.../openzfs/include/os/freebsd/spl/sys/Makefile.am |=C2=A0= =C2=A01 -<br> =C2=A0.../openzfs/include/os/freebsd/spl/sys/cred.h=C2=A0 =C2=A0= =C2=A0 | 136 ++--------------<br> =C2=A0.../openzfs/include/os/freebsd/spl/sys/kidmap.h=C2=A0 =C2= =A0 |=C2=A0 41 -----<br> =C2=A0.../openzfs/include/os/freebsd/spl/sys/sid.h=C2=A0 =C2=A0= =C2=A0 =C2=A0|=C2=A0 25 ---<br> =C2=A0.../include/os/linux/kernel/linux/simd_x86.h=C2=A0 =C2=A0= =C2=A0 =C2=A0|=C2=A0 =C2=A04 +-<br> =C2=A0.../openzfs/include/os/linux/spl/sys/cred.h=C2=A0 =C2=A0 = =C2=A0 =C2=A0 |=C2=A0 =C2=A05 -<br> =C2=A0sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c=C2=A0 =C2=A0= =C2=A0|=C2=A0 =C2=A01 -<br> =C2=A0.../lib/libzutil/os/linux/zutil_device_path_os.c=C2=A0 =C2= =A0|=C2=A0 28 ++--<br> =C2=A0sys/contrib/openzfs/module/Makefile.bsd=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +-<br> =C2=A0.../openzfs/module/os/freebsd/spl/spl_sysevent.c=C2=A0 =C2= =A0|=C2=A0 12 +-<br> =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_acl.c=C2=A0 =C2=A0 = =C2=A0 =C2=A0 |=C2=A0 =C2=A06 +-<br> =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c=C2=A0 =C2= =A0|=C2=A0 19 +--<br> =C2=A0.../openzfs/module/os/freebsd/zfs/zfs_znode.c=C2=A0 =C2=A0= =C2=A0 |=C2=A0 =C2=A04 +-<br> =C2=A0sys/contrib/openzfs/module/os/linux/spl/spl-cred.c |=C2=A0= 42 +----<br> =C2=A0sys/contrib/openzfs/module/os/linux/zfs/policy.c=C2=A0 =C2= =A0|=C2=A0 10 +-<br> =C2=A0.../openzfs/module/os/linux/zfs/zpl_inode.c=C2=A0 =C2=A0 = =C2=A0 =C2=A0 |=C2=A0 =C2=A04 +-<br> =C2=A0.../openzfs/module/os/linux/zfs/zpl_xattr.c=C2=A0 =C2=A0 = =C2=A0 =C2=A0 |=C2=A0 =C2=A04 +-<br> =C2=A0sys/contrib/openzfs/module/zfs/arc.c=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A02 +-<br> =C2=A0sys/modules/zfs/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2= =A02 +-<br> =C2=A0sys/modules/zfs/zfs_config.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A08 +-<br= > =C2=A0sys/modules/zfs/zfs_gitrev.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A03 +-<br= > =C2=A025 files changed, 242 insertions(+), 312 deletions(-)<br> <br> diff --git a/sys/conf/<a href=3D"http://kern.pre.mk" rel=3D"noreferrer" target=3D"_blank" moz-do-not-send=3D"true"= >kern.pre.mk</a> b/sys/conf/<a href=3D"http://kern.pre.mk" rel=3D"noreferrer" target=3D"_blank" moz-do-not-send=3D"true">kern.pre.mk</a><br= > index d6ab5e17a82a..6be49642b04e 100644<br> --- a/sys/conf/<a href=3D"http://kern.pre.mk" rel=3D"noreferrer= " target=3D"_blank" moz-do-not-send=3D"true">kern.pre.mk</a><br= > +++ b/sys/conf/<a href=3D"http://kern.pre.mk" rel=3D"noreferrer= " target=3D"_blank" moz-do-not-send=3D"true">kern.pre.mk</a><br= > @@ -262,7 +262,7 @@ CDDL_C=3D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}<br> =C2=A0# Special flags for managing the compat compiles for ZFS<= br> =C2=A0ZFS_CFLAGS+=3D=C2=A0 =C2=A0${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 -DWITH_NETDUMP -D__KERNEL__ -D_SYS_= CONDVAR_H_ -DSMP \<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0-DIN_FREEBSD_BASE -DHAVE_KSID<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0-DIN_FREEBSD_BASE<br> <br> =C2=A0.if ${MACHINE_ARCH} =3D=3D "amd64"<br> =C2=A0ZFS_CFLAGS+=3D -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_S= SE2 -DHAVE_AVX512F \<br> diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META<br> index 0437224b403f..76e59a42074c 100644<br> --- a/sys/contrib/openzfs/META<br> +++ b/sys/contrib/openzfs/META<br> @@ -1,10 +1,10 @@<br> =C2=A0Meta:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1<br> =C2=A0Name:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs<br> =C2=A0Branch:=C2=A0 =C2=A0 =C2=A0 =C2=A0 1.0<br> -Version:=C2=A0 =C2=A0 =C2=A0 =C2=A02.1.3<br> +Version:=C2=A0 =C2=A0 =C2=A0 =C2=A02.1.4<br> =C2=A0Release:=C2=A0 =C2=A0 =C2=A0 =C2=A01<br> =C2=A0Release-Tags:=C2=A0 relext<br> =C2=A0License:=C2=A0 =C2=A0 =C2=A0 =C2=A0CDDL<br> =C2=A0Author:=C2=A0 =C2=A0 =C2=A0 =C2=A0 OpenZFS<br> -Linux-Maximum: 5.16<br> +Linux-Maximum: 5.17<br> =C2=A0Linux-Minimum: 3.10<br> diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c<br> index 3bcdf6e1d718..a510d646e1f9 100644<br> --- a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c<br> +++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c<br> @@ -183,14 +183,14 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 nvlist_t *nvroot, *newvd;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 pendingdev_t *device;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t wholedisk =3D 0ULL;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t offline =3D 0ULL;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t offline =3D 0ULL, faulted = =3D 0ULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t guid =3D 0ULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *physpath =3D NULL, *new_devid= =3D NULL, *enc_sysfs_path =3D NULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char rawpath[PATH_MAX], fullpath[PA= TH_MAX];<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char devpath[PATH_MAX];<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 int ret;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_dm =3D B_FALSE;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t is_sd =3D B_FALSE;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_mpath_wholedisk =3D B_= FALSE;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint_t c;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdev_stat_t *vs;<br> <br> @@ -211,15 +211,73 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &enc_sysfs_path);= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_OFFLINE, &offline);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_FAULTED, &faulted);<br> +<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(vdev, Z= POOL_CONFIG_GUID, &guid);<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (offline)<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return;= =C2=A0 /* don't intervene if it was taken offline */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Special case:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We've seen times where a disk wo= n't have a ZPOOL_CONFIG_PHYS_PATH<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * entry in their config. For examp= le, on this force-faulted disk:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 children[0]:= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= type: 'disk'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= id: 0<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= guid: 14309659774640089719<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 path:= '/dev/disk/by-vdev/L28'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 whole= _disk: 0<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 DTL: = 654<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 creat= e_txg: 4<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 com.d= elphix:vdev_zap_leaf: 1161<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 fault= ed: 1<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 aux_s= tate: 'external'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 children[1]:= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 type:= 'disk'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 id: 1= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 guid:= 16002508084177980912<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 path:= '/dev/disk/by-vdev/L29'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 devid= : 'dm-uuid-mpath-35000c500a61d68a3'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 phys_= path: 'L29'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 vdev_= enc_sysfs_path: '/sys/class/enclosure/0:0:1:0/SLOT 30 32'<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 whole= _disk: 0<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 DTL: = 1028<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 creat= e_txg: 4<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 =C2=A0 com.d= elphix:vdev_zap_leaf: 131<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * If the disk's path is a /dev/dis= k/by-vdev/ path, then we can infer<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * the ZPOOL_CONFIG_PHYS_PATH from = the by-vdev disk name.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (physpath =3D=3D NULL &&= path !=3D NULL) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If p= ath begins with "/dev/disk/by-vdev/" ... */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (str= ncmp(path, DEV_BYVDEV_PATH,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0strlen(DEV_BYVDEV_PATH)) =3D=3D 0) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0/* Set physpath to the char after "/dev/disk/by-vdev" */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0physpath =3D &path[strlen(DEV_BYVDEV_PATH)];<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We don't want to autoreplace off= lined disks.=C2=A0 However, we do want to<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * replace force-faulted disks (`zp= ool offline -f`).=C2=A0 Force-faulted<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * disks have both offline=3D1 and = faulted=3D1 in the nvlist.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (offline && !faulted) {<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO, "%s: %s is offline, skip autoreplace",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0__func__, path);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return;= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0is_dm =3D zfs_dev_is_dm(path);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0is_mpath_wholedisk =3D is_mpath_who= le_disk(path);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log_msg(LOG_INFO, "zfs_process_= add: pool '%s' vdev '%s', phys '%s'"<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" wholedisk %d, %s dm= (guid %llu)", zpool_get_name(zhp), path,<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0physpath ? physpath := "NULL", wholedisk, is_dm ? "is" : "not",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" %s blank disk, %s m= path blank disk, %s labeled, enc sysfs '%s', "<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"(guid %llu)",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zpool_get_name(zhp), = path,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0physpath ? physpath := "NULL",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wholedisk ? "is" : "n= ot",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_mpath_wholedisk? "= is" : "not",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0labeled ? "is" : "not= ",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enc_sysfs_path,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (long long unsigned i= nt)guid);<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br> @@ -253,8 +311,9 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ZFS_ONLINE_CHECKREMOV= E | ZFS_ONLINE_UNSPARE, &newstate) =3D=3D 0 &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (newstate =3D=3D VDEV= _STATE_HEALTHY ||<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 newstate =3D=3D VDEV_= STATE_DEGRADED)) {<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO, "=C2=A0 zpool_vdev_online: vdev %s is %s",<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0fullpath, (newstate =3D=3D VDEV_STATE_HEALTHY) ?<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"=C2=A0 zpool_vdev_online: vdev '%s' ('%s') is "<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"%s", fullpath, physpath, (newstate =3D=3D VDEV_STATE_HEALTHY) ?<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 "HEALTHY" : "DEGRADED");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> @@ -271,11 +330,12 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* vdev online to trigger a FM= A fault by posting an ereport.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!zpool_get_prop_int(zhp, ZPOOL_= PROP_AUTOREPLACE, NULL) ||<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!(wholedisk || is_dm)= || (physpath =3D=3D NULL)) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!(wholedisk || is_mpa= th_wholedisk) || (physpath =3D=3D NULL)) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) = zpool_vdev_online(zhp, fullpath, ZFS_ONLINE_FORCEFAULT,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 &newstate);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log= _msg(LOG_INFO, "Pool's autoreplace is not enabled or "<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"not a whole disk for '%s'", fullpath);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"not a blank disk for '%s' ('%s')", fullpath,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0physpath);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> <br> @@ -287,7 +347,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) snprintf(rawpath, sizeof (ra= wpath), "%s%s",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 is_sd ? DEV_BYVDEV_PA= TH : DEV_BYPATH_PATH, physpath);<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (realpath(rawpath, devpath) =3D=3D= NULL && !is_dm) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (realpath(rawpath, devpath) =3D=3D= NULL && !is_mpath_wholedisk) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log= _msg(LOG_INFO, "=C2=A0 realpath: %s failed (%s)",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 rawpath, strerror(errno));<br> <br> @@ -303,12 +363,14 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((vs->vs_state !=3D VDEV_STAT= E_DEGRADED) &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vs->vs_state !=3D= VDEV_STATE_FAULTED) &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vs->vs_state !=3D= VDEV_STATE_CANT_OPEN)) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO, "=C2=A0 not autoreplacing since disk isn't in "<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"a bad state (currently %d)", vs->vs_state);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 nvlist_lookup_string(vdev, "new_dev= id", &new_devid);<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_dm) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_mpath_wholedisk) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Don'= t label device mapper or multipath disks. */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (!labeled) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br> @@ -522,8 +584,11 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*= the dp->dd_compare value.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*= /<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (nvl= ist_lookup_string(nvl, dp->dd_prop, &path) !=3D 0 ||<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0strcmp(dp->dd_compare, path) !=3D 0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0strcmp(dp->dd_compare, path) !=3D 0) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO, "=C2=A0 %s: no match (%s !=3D vdev %s)",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__, dp->dd_compare, path);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 return;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zed_log= _msg(LOG_INFO, "=C2=A0 zfs_iter_vdev: matched %s on %s",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 dp->dd_prop, path);<br> @@ -571,6 +636,8 @@ zfs_iter_pool(zpool_handle_t *zhp, void *data)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ZPOOL_CONFIG_VDEV_TREE, &nvl);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 zfs_iter_vdev(zhp, nvl, data);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0} else {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO, "%s: no config\n", __func__);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br> @@ -619,6 +686,72 @@ devphys_iter(const char *physical, const char *devid, zfs_process_func_t func,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (data.dd_found);<br> =C2=A0}<br> <br> +/*<br> + * Given a device identifier, find any vdevs with a matching by-vdev<br> + * path.=C2=A0 Normally we shouldn't need this as the comparis= on would be<br> + * made earlier in the devphys_iter().=C2=A0 For example, if w= e were replacing<br> + * /dev/disk/by-vdev/L28, normally devphys_iter() would match the<br> + * ZPOOL_CONFIG_PHYS_PATH of "L28" from the old disk config to "L28"<br> + * of the new disk config.=C2=A0 However, we've seen cases whe= re<br> + * ZPOOL_CONFIG_PHYS_PATH was not in the config for the old disk.=C2=A0 Here's<br> + * an example of a real 2-disk mirror pool where one disk was force<br> + * faulted:<br> + *<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0com.delphix:vdev_zap_top: 129<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0children[0]:<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0type:= 'disk'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id: 0= <br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0guid:= 14309659774640089719<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0path:= '/dev/disk/by-vdev/L28'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whole= _disk: 0<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DTL: = 654<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0creat= e_txg: 4<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0com.d= elphix:vdev_zap_leaf: 1161<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fault= ed: 1<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0aux_s= tate: 'external'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0children[1]:<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0type:= 'disk'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0id: 1= <br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0guid:= 16002508084177980912<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0path:= '/dev/disk/by-vdev/L29'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0devid= : 'dm-uuid-mpath-35000c500a61d68a3'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0phys_= path: 'L29'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vdev_= enc_sysfs_path: '/sys/class/enclosure/0:0:1:0/SLOT 30 32'<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whole= _disk: 0<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DTL: = 1028<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0creat= e_txg: 4<br> + *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0com.d= elphix:vdev_zap_leaf: 131<br> + *<br> + * So in the case above, the only thing we could compare is the path.<br> + *<br> + * We can do this because we assume by-vdev paths are authoritative as physical<br> + * paths.=C2=A0 We could not assume this for normal paths like /dev/sda since the<br> + * physical location /dev/sda points to could change over time.<br> + */<br> +static boolean_t<br> +by_vdev_path_iter(const char *by_vdev_path, const char *devid,<br> +=C2=A0 =C2=A0 zfs_process_func_t func, boolean_t is_slice)<br> +{<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0dev_data_t data =3D { 0 };<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_compare =3D by_vdev_path;<b= r> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_func =3D func;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_prop =3D ZPOOL_CONFIG_PATH;= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_found =3D B_FALSE;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_islabeled =3D is_slice;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0data.dd_new_devid =3D devid;<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (strncmp(by_vdev_path, DEV_BYVDE= V_PATH,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0strlen(DEV_BYVDEV_PAT= H)) !=3D 0) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* by_v= dev_path doesn't start with "/dev/disk/by-vdev/" */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return = (B_FALSE);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0(void) zpool_iter(g_zfshdl, zfs_ite= r_pool, &data);<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (data.dd_found);<br> +}<br> +<br> =C2=A0/*<br> =C2=A0 * Given a device identifier, find any vdevs with a match= ing devid.<br> =C2=A0 * On Linux we can match devid directly which is always a whole disk.<br> @@ -683,15 +816,17 @@ guid_iter(uint64_t pool_guid, uint64_t vdev_guid, const char *devid,<br> =C2=A0static int<br> =C2=A0zfs_deliver_add(nvlist_t *nvl, boolean_t is_lofi)<br> =C2=A0{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0char *devpath =3D NULL, *devid;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0char *devpath =3D NULL, *devid =3D = NULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t pool_guid =3D 0, vdev_guid= =3D 0;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t is_slice;<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Expecting a devid string an= d an optional physical location and guid<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (nvlist_lookup_string(nvl, DEV_I= DENTIFIER, &devid) !=3D 0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (nvlist_lookup_string(nvl, DEV_I= DENTIFIER, &devid) !=3D 0) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zed_log= _msg(LOG_INFO, "%s: no dev identifier\n", __func__);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (-1);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_string(nvl, DE= V_PHYS_PATH, &devpath);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) nvlist_lookup_uint64(nvl, ZF= S_EV_POOL_GUID, &pool_guid);<br> @@ -707,6 +842,8 @@ zfs_deliver_add(nvlist_t *nvl, boolean_t is_lofi)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 1. ZPOOL_CONFIG_DEVID (iden= tifies the unique disk)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 2. ZPOOL_CONFIG_PHYS_PATH (= identifies disk physical location).<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* 3. ZPOOL_CONFIG_GUID (ident= ifies unique vdev).<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * 4. ZPOOL_CONFIG_PATH for /dev/di= sk/by-vdev devices only (since<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 by-vdev paths repre= sent physical paths).<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (devid_iter(devid, zfs_process_a= dd, is_slice))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (0);<br> @@ -717,6 +854,16 @@ zfs_deliver_add(nvlist_t *nvl, boolean_t is_lofi)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) = guid_iter(pool_guid, vdev_guid, devid, zfs_process_add,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 is_slice);<br> <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (devpath !=3D NULL) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Can = we match a /dev/disk/by-vdev/ path? */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char by= _vdev_path[MAXPATHLEN];<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0snprint= f(by_vdev_path, sizeof (by_vdev_path),<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"/dev/disk/by-vdev/%s", devpath);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (by_= vdev_path_iter(by_vdev_path, devid, zfs_process_add,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0is_slice))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0return (0);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> +<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0);<br> =C2=A0}<br> <br> diff --git a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c<br> index 94e24236063c..52b80d8c4c93 100644<br> --- a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c<br> +++ b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c<br> @@ -215,6 +215,11 @@ zed_udev_monitor(void *arg)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (typ= e !=3D NULL && type[0] !=3D '\0' &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 strcmp(type, "disk") =3D=3D 0 &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 part !=3D NULL && part[0] !=3D '\0') {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s: skip %s since it has a %s partition already",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0udev_device_get_property_value(dev, "DEVNAME"),<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0part);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 /* skip and wait for partition event */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 udev_device_unref(dev);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 continue;<br> @@ -229,6 +234,11 @@ zed_udev_monitor(void *arg)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 sectors =3D udev_device_get_sysattr_value(dev, "size");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (sec= tors !=3D NULL &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 strtoull(sectors, NULL, 10) < MINIMUM_SECTORS) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0zed_log_msg(LOG_INFO,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"%s: %s sectors %s < %llu (minimum)",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0udev_device_get_property_value(dev, "DEVNAME"),<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sectors, MINIMUM_SECTORS);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 udev_device_unref(dev);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 continue;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am<br= > index 232aaf569fa2..7488e56c7649 100644<br> --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am<br= > +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am<br= > @@ -22,7 +22,6 @@ KERNEL_H =3D \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 inttypes.h \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 isa_defs.h \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem_cache.h \<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0kidmap.h \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem.h \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kstat.h \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 list_impl.h \<br> diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h<br> index 86f79011d6da..db986af57bf5 100644<br> --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h<br> +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cred.h<br> @@ -48,138 +48,20 @@ extern "C" {<br> =C2=A0typedef struct ucred cred_t;<br> <br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 CRED()=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 curthread->td_ucred<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kcred=C2=A0 =C2=A0(thread0.= td_ucred)<br> -<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KUID_TO_SUID(x)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(x)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KGID_TO_SGID(x)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(x)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetuid(cred)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 ((cred)->cr_uid)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetruid(cred)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0((cred)->cr_ruid)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgid(cred)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 ((cred)->cr_gid)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgroups(cred)=C2=A0 =C2= =A0 =C2=A0 =C2=A0((cred)->cr_groups)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetngroups(cred)=C2=A0 =C2= =A0 =C2=A0 ((cred)->cr_ngroups)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetsid(cred, i)=C2=A0 =C2= =A0 =C2=A0 =C2=A0(NULL)<br> <br> -struct proc;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* cred.h is included in proc.h */<br> -struct prcred;<br> -struct ksid;<br> -struct ksidlist;<br> -struct credklpd;<br> -struct credgrp;<br> -<br> -struct auditinfo_addr;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0/* cred.h is included in audit.h */<br> -<br> -extern int ngroups_max;<br> =C2=A0/*<br> =C2=A0 * kcred is used when you need all privileges.<br> =C2=A0 */<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kcred=C2=A0 =C2=A0(thread0.= td_ucred)<br> <br> -extern void cred_init(void);<br> -extern void crfree(cred_t *);<br> -extern cred_t *cralloc(void);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= /* all but ref uninitialized */<br> -extern cred_t *cralloc_ksid(void);=C2=A0 =C2=A0 =C2=A0/* crall= oc() + ksid alloc'ed */<br> -extern cred_t *crget(void);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 /* initialized */<br> -extern void crcopy_to(cred_t *, cred_t *);<br> -extern cred_t *crdup(cred_t *);<br> -extern void crdup_to(cred_t *, cred_t *);<br> -extern cred_t *crgetcred(void);<br> -extern void crset(struct proc *, cred_t *);<br> -extern void crset_zone_privall(cred_t *);<br> -extern int supgroupmember(gid_t, const cred_t *);<br> -extern int hasprocperm(const cred_t *, const cred_t *);<br> -extern int prochasprocperm(struct proc *, struct proc *, const cred_t *);<br> -extern int crcmp(const cred_t *, const cred_t *);<br> -extern cred_t *zone_kcred(void);<br> -<br> -extern gid_t crgetrgid(const cred_t *);<br> -extern gid_t crgetsgid(const cred_t *);<br> -<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetzoneid(cr) ((cr)->c= r_prison->pr_id)<br> -extern projid_t crgetprojid(const cred_t *);<br> -<br> -extern cred_t *crgetmapped(const cred_t *);<br> -<br> -<br> -extern const struct auditinfo_addr *crgetauinfo(const cred_t *);<br> -extern struct auditinfo_addr *crgetauinfo_modifiable(cred_t *);<br> -<br> -extern uint_t crgetref(const cred_t *);<br> -<br> -extern const gid_t *crgetggroups(const struct credgrp *);<br> -<br> -<br> -/*<br> - * Sets real, effective and/or saved uid/gid;<br> - * -1 argument accepted as "no change".<br> - */<br> -extern int crsetresuid(cred_t *, uid_t, uid_t, uid_t);<br> -extern int crsetresgid(cred_t *, gid_t, gid_t, gid_t);<br> -<br> -/*<br> - * Sets real, effective and saved uids/gids all to the same<br= > - * values.=C2=A0 Both values must be non-negative and <=3D = MAXUID<br> - */<br> -extern int crsetugid(cred_t *, uid_t, gid_t);<br> -<br> -/*<br> - * Functions to handle the supplemental group list.<br> - */<br> -extern struct credgrp *crgrpcopyin(int, gid_t *);<br> -extern void crgrprele(struct credgrp *);<br> -extern void crsetcredgrp(cred_t *, struct credgrp *);<br> -<br> -/*<br> - * Private interface for setting zone association of credential.<br> - */<br> -struct zone;<br> -extern void crsetzone(cred_t *, struct zone *);<br> -extern struct zone *crgetzone(const cred_t *);<br> -<br> -/*<br> - * Private interface for setting project id in credential.<br> - */<br> -extern void crsetprojid(cred_t *, projid_t);<br> -<br> -/*<br> - * Private interface for nfs.<br> - */<br> -extern cred_t *crnetadjust(cred_t *);<br> -<br> -/*<br> - * Private interface for procfs.<br> - */<br> -extern void cred2prcred(const cred_t *, struct prcred *);<br> -<br> -/*<br> - * Private interfaces for Rampart Trusted Solaris.<br> - */<br> -struct ts_label_s;<br> -extern struct ts_label_s *crgetlabel(const cred_t *);<br> -extern boolean_t crisremote(const cred_t *);<br> -<br> -/*<br> - * Private interfaces for ephemeral uids.<br> - */<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 VALID_UID(id, zn)=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0((id) <=3D MAXUID || valid_ephem= eral_uid((zn), (id)))<br> -<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 VALID_GID(id, zn)=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0((id) <=3D MAXUID || valid_ephem= eral_gid((zn), (id)))<br> -<br> -extern boolean_t valid_ephemeral_uid(struct zone *, uid_t);<br= > -extern boolean_t valid_ephemeral_gid(struct zone *, gid_t);<br= > -<br> -extern int eph_uid_alloc(struct zone *, int, uid_t *, int);<br= > -extern int eph_gid_alloc(struct zone *, int, gid_t *, int);<br= > -<br> -extern void crsetsid(cred_t *, struct ksid *, int);<br> -extern void crsetsidlist(cred_t *, struct ksidlist *);<br> -<br> -extern struct ksidlist *crgetsidlist(const cred_t *);<br> -<br> -extern int crsetpriv(cred_t *, ...);<br> -<br> -extern struct credklpd *crgetcrklpd(const cred_t *);<br> -extern void crsetcrklpd(cred_t *, struct credklpd *);<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KUID_TO_SUID(x)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(x)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 KGID_TO_SGID(x)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(x)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetuid(cr)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ((cr)->cr_uid)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetruid(cr)=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0((cr)->cr_ruid)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgid(cr)=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ((cr)->cr_gid)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetgroups(cr)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0((cr)->cr_groups)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetngroups(cr)=C2=A0 =C2=A0= =C2=A0 =C2=A0 ((cr)->cr_ngroups)<br> +#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 crgetzoneid(cr)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0((cr)->cr_prison->pr_id)<br> <br> =C2=A0#ifdef __cplusplus<br> =C2=A0}<br> diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h<br> deleted file mode 100644<br> index dc0cf5988a42..000000000000<br> --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kidmap.h<b= r> +++ /dev/null<br> @@ -1,41 +0,0 @@<br> -/*<br> - * Copyright (c) 2007 Pawel Jakub Dawidek <a class=3D"moz-txt-link-rfc2396E" href=3D"mailto:pjd@FreeBSD.o= rg"><pjd@FreeBSD.org></a><br> - * All rights reserved.<br> - *<br> - * Redistribution and use in source and binary forms, with or without<br> - * modification, are permitted provided that the following conditions<br> - * are met:<br> - * 1. Redistributions of source code must retain the above copyright<br> - *=C2=A0 =C2=A0 notice, this list of conditions and the follow= ing disclaimer.<br> - * 2. Redistributions in binary form must reproduce the above copyright<br> - *=C2=A0 =C2=A0 notice, this list of conditions and the follow= ing disclaimer in the<br> - *=C2=A0 =C2=A0 documentation and/or other materials provided = with the distribution.<br> - *<br> - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND<br> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br> - * ARE DISCLAIMED.=C2=A0 IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE<br> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL<br> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS<br> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)<br> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT<br> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY<br> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF<br> - * SUCH DAMAGE.<br> - *<br> - * $FreeBSD$<br> - */<br> -<br> -#ifndef _OPENSOLARIS_SYS_KIDMAP_H_<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _OPENSOLARIS_SYS_KIDMAP_H_<= br> -<br> -#include <sys/idmap.h><br> -<br> -typedef int32_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 idmap_stat;<br> -typedef void=C2=A0 =C2=A0idmap_get_handle_t;<br> -<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_create()=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(NULL)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_destroy(hdl)=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0do { } while (0)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_get_mappings(hdl)=C2= =A0 =C2=A0 =C2=A0 =C2=A0 (NULL)<br> -<br> -#endif /* _OPENSOLARIS_SYS_KIDMAP_H_ */<br> diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h<br> index d3fab8b24744..f249d05d55a0 100644<br> --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h<br> +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/sid.h<br> @@ -29,7 +29,6 @@<br> =C2=A0#ifndef _OPENSOLARIS_SYS_SID_H_<br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _OPENSOLARIS_SYS_SID_H= _<br> =C2=A0#include <sys/idmap.h><br> -#include <sys/kidmap.h><br> <br> =C2=A0typedef struct ksiddomain {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char=C2=A0 =C2=A0 *kd_name;=C2=A0 =C2= =A0 =C2=A0 =C2=A0/* Domain part of SID */<br> @@ -59,28 +58,4 @@ ksiddomain_rele(ksiddomain_t *kd)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmem_free(kd, sizeof (*kd));<br> =C2=A0}<br> <br> -static __inline uint_t<br> -ksid_getid(ksid_t *ks)<br> -{<br> -<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly cal= led", __func__);<br> -}<br> -<br> -static __inline const char *<br> -ksid_getdomain(ksid_t *ks)<br> -{<br> -<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly cal= led", __func__);<br> -}<br> -<br> -static __inline uint_t<br> -ksid_getrid(ksid_t *ks)<br> -{<br> -<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0panic("%s has been unexpectedly cal= led", __func__);<br> -}<br> -<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_getsidbyuid(zone, ui= d, sid_prefix, rid)=C2=A0 (1)<br> -#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 kidmap_getsidbygid(zone, gi= d, sid_prefix, rid)=C2=A0 (1)<br> -<br> =C2=A0#endif /* _OPENSOLARIS_SYS_SID_H_ */<br> diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h<= br> index 6d4c7a09fe82..0f6a222ba667 100644<br> --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h<= br> +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/simd_x86.h<= br> @@ -420,9 +420,9 @@ kfpu_end(void)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (static_cpu_has(X86_FEATURE_XSAV= E)) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfpu_do= _xrstor("xrstor", &state->xsave, ~0);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (static_cpu_has(X86_FEATU= RE_FXSR)) {<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_sa= ve_fxsr(&state->fxsave);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_re= store_fxsr(&state->fxsave);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else {<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_sa= ve_fsave(&state->fsave);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfpu_re= store_fsave(&state->fsave);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> =C2=A0out:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 local_irq_enable();<br> diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h<br> index 9cc85deb5c8a..b7d3f38d70bb 100644<br> --- a/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h<br> +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h<br> @@ -49,12 +49,7 @@ extern void crhold(cred_t *cr);<br> =C2=A0extern void crfree(cred_t *cr);<br> =C2=A0extern uid_t crgetuid(const cred_t *cr);<br> =C2=A0extern uid_t crgetruid(const cred_t *cr);<br> -extern uid_t crgetsuid(const cred_t *cr);<br> -extern uid_t crgetfsuid(const cred_t *cr);<br> =C2=A0extern gid_t crgetgid(const cred_t *cr);<br> -extern gid_t crgetrgid(const cred_t *cr);<br> -extern gid_t crgetsgid(const cred_t *cr);<br> -extern gid_t crgetfsgid(const cred_t *cr);<br> =C2=A0extern int crgetngroups(const cred_t *cr);<br> =C2=A0extern gid_t *crgetgroups(const cred_t *cr);<br> =C2=A0extern int groupmember(gid_t gid, const cred_t *cr);<br> diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c b/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c<br> index 644dd26859f1..f77becd6a5c1 100644<br> --- a/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c<br> +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c<br> @@ -606,7 +606,6 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,<br> =C2=A0kfdok:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((key =3D fdopen(kfd, "r+")) =3D= =3D NULL) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D= errno;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0free(pa= th);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) = close(kfd);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_err= or_aux(hdl, dgettext(TEXT_DOMAIN,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 "Couldn't reopen temporary file: %s"), strerror(ret));<br> diff --git a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_o= s.c b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c<br> index 13f8bd031612..45a6f6f5935b 100644<br> --- a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_o= s.c<br> +++ b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_o= s.c<br> @@ -527,7 +527,7 @@ zfs_dev_is_dm(const char *dev_name)<br> =C2=A0boolean_t<br> =C2=A0zfs_dev_is_whole_disk(const char *dev_name)<br> =C2=A0{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0struct dk_gpt *label;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0struct dk_gpt *label =3D NULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 int fd;<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((fd =3D open(dev_name, O_RDONLY= | O_DIRECT | O_CLOEXEC)) < 0)<br> @@ -613,22 +613,24 @@ zfs_get_underlying_path(const char *dev_name)<br> =C2=A0/*<br> =C2=A0 * A disk is considered a multipath whole disk when:<br> =C2=A0 *=C2=A0 =C2=A0 =C2=A0DEVNAME key value has "dm-"<br> - *=C2=A0 =C2=A0 =C2=A0DM_NAME key value has "mpath" prefix<br> - *=C2=A0 =C2=A0 =C2=A0DM_UUID key exists<br> + *=C2=A0 =C2=A0 =C2=A0DM_UUID key exists and starts with 'mpat= h-'<br> =C2=A0 *=C2=A0 =C2=A0 =C2=A0ID_PART_TABLE_TYPE key does not exi= st or is not gpt<br> + *=C2=A0 =C2=A0 =C2=A0ID_FS_LABEL key does not exist (disk isn= 't labeled)<br> =C2=A0 */<br> =C2=A0static boolean_t<br> -udev_mpath_whole_disk(struct udev_device *dev)<br> +is_mpath_udev_sane(struct udev_device *dev)<br> =C2=A0{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0const char *devname, *type, *uuid;<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0const char *devname, *type, *uuid, = *label;<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 devname =3D udev_device_get_propert= y_value(dev, "DEVNAME");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 type =3D udev_device_get_property_v= alue(dev, "ID_PART_TABLE_TYPE");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uuid =3D udev_device_get_property_v= alue(dev, "DM_UUID");<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0label =3D udev_device_get_property_= value(dev, "ID_FS_LABEL");<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((devname !=3D NULL && s= trncmp(devname, "/dev/dm-", 8) =3D=3D 0) &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((type =3D=3D NULL) |= | (strcmp(type, "gpt") !=3D 0)) &&<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(uuid !=3D NULL)) {<b= r> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((uuid !=3D NULL) &am= p;& (strncmp(uuid, "mpath-", 6) =3D=3D 0)) &&<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(label =3D=3D NULL)) = {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (B_TRUE);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> <br> @@ -636,7 +638,11 @@ udev_mpath_whole_disk(struct udev_device *dev)<br> =C2=A0}<br> <br> =C2=A0/*<br> - * Check if a disk is effectively a multipath whole disk<br> + * Check if a disk is a multipath "blank" disk:<br> + *<br> + * 1. The disk has udev values that suggest it's a multipath disk<br> + * 2. The disk is not currently labeled with a filesystem of any type<br> + * 3. There are no partitions on the disk<br> =C2=A0 */<br> =C2=A0boolean_t<br> =C2=A0is_mpath_whole_disk(const char *path)<br> @@ -645,7 +651,6 @@ is_mpath_whole_disk(const char *path)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct udev_device *dev =3D NULL;<b= r> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char nodepath[MAXPATHLEN];<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *sysname;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t wholedisk =3D B_FALSE;<br= > <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (realpath(path, nodepath) =3D=3D= NULL)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (B_FALSE);<br> @@ -660,10 +665,11 @@ is_mpath_whole_disk(const char *path)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (B_FALSE);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0wholedisk =3D udev_mpath_whole_disk= (dev);<br> -<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Sanity check some udev values */= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0boolean_t is_sane =3D is_mpath_udev= _sane(dev);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 udev_device_unref(dev);<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (wholedisk);<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (is_sane);<br> =C2=A0}<br> <br> =C2=A0#else /* HAVE_LIBUDEV */<br> diff --git a/sys/contrib/openzfs/module/Makefile.bsd b/sys/contrib/openzfs/module/Makefile.bsd<br> index 8aa4ed22275e..dc6cc2b74243 100644<br> --- a/sys/contrib/openzfs/module/Makefile.bsd<br> +++ b/sys/contrib/openzfs/module/Makefile.bsd<br> @@ -32,7 +32,7 @@ CFLAGS+=3D -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h<br> <br> =C2=A0CFLAGS+=3D -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZF= S=C2=A0 -D__BSD_VISIBLE=3D1 \<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DHAVE_UIO_ZEROCOPY -DWITHOUT= _NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DS= MP -DHAVE_KSID -DCOMPAT_FREEBSD11<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DS= MP -DCOMPAT_FREEBSD11<br> <br> =C2=A0.if ${MACHINE_ARCH} =3D=3D "amd64"<br> =C2=A0CFLAGS+=3D -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_SSSE3<br> diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c<br> index d5d50080fafd..16188c71b53d 100644<br> --- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c<= br> +++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c<= br> @@ -250,7 +250,17 @@ sysevent_worker(void *arg __unused)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 nvlist_free(event);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0zfs_zevent_destroy(ze);<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We avoid zfs_zevent_destroy() he= re because we're otherwise racing<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * against fm_fini() destroying the= zevent_lock.=C2=A0 zfs_zevent_destroy()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * will currently only clear `ze-&g= t;ze_zevent` from an event list then<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * free `ze`, so just inline the fr= ee() here -- events have already<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 * been drained.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0VERIFY3P(ze->ze_zevent, =3D=3D, = NULL);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0kmem_free(ze, sizeof (zfs_zevent_t)= );<br> +<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kthread_exit();<br> =C2=A0}<br> <br> diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c<br> index ae758bcefe21..fe0f69132321 100644<br> --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c<br> +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c<br> @@ -1653,8 +1653,10 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ZFS_GROUP, &acl_ids->z_fuidp);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid =3D= vap->va_gid;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else {<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0acl_ids= ->z_fuid =3D zfs_fuid_create_cred(zfsvfs, ZFS_OWNER,<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0cr, &acl_ids->z_fuidp);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t i= d =3D crgetuid(cr);<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (IS_= EPHEMERAL(id))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0id =3D UID_NOBODY;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0acl_ids= ->z_fuid =3D (uint64_t)id;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 acl_ids= ->z_fgid =3D 0;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vap= ->va_mask & AT_GID)=C2=A0 {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 acl_ids->z_fgid =3D zfs_fuid_create(zfsvfs,<br> diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c<br> index 7bcf80bf5a94..b2cc3d063f9c 100644<br> --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c<= br> +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c<= br> @@ -1060,8 +1060,7 @@ zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 objset_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= *os;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 dmu_tx_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= *tx;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0error;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 *ksid;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0uid;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0uid =3D crgetuid(cr);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0gid =3D crgetgid(cr);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= projid =3D ZFS_DEFAULT_PROJID;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_acl_ids_t=C2=A0 =C2=A0acl_ids;<= br> @@ -1075,13 +1074,6 @@ zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If we have an ephemeral id,= ACL, or XVATTR then<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* make sure file system is at= proper version<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br> -<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid =3D crgetsid(cr, KSID_OWNER);<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ksid)<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D= ksid_getid(ksid);<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D= crgetuid(cr);<br> -<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zfsvfs->z_use_fuids =3D=3D B= _FALSE &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (vsecp || (vap->va= _mask & AT_XVATTR) ||<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IS_EPHEMERAL(uid) || = IS_EPHEMERAL(gid)))<br> @@ -1415,8 +1407,7 @@ zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= txtype;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 dmu_tx_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= *tx;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0error;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 *ksid;<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0uid;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0uid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0uid =3D crgetuid(cr);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 gid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0gid =3D crgetgid(cr);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs_acl_ids_t=C2=A0 =C2=A0acl_ids;<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 boolean_t=C2=A0 =C2=A0 =C2=A0 =C2=A0= fuid_dirtied;<br> @@ -1427,12 +1418,6 @@ zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If we have an ephemeral id,= ACL, or XVATTR then<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* make sure file system is at= proper version<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br> -<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0ksid =3D crgetsid(cr, KSID_OWNER);<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ksid)<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D= ksid_getid(ksid);<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uid =3D= crgetuid(cr);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zfsvfs->z_use_fuids =3D=3D B= _FALSE &&<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((vap->va_mask &am= p; AT_XVATTR) ||<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IS_EPHEMERAL(uid) || = IS_EPHEMERAL(gid)))<br> diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c<br> index d14df9d88a35..8a2773ac7971 100644<br> --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c<br> +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c<br> @@ -839,7 +839,9 @@ zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 xoap =3D xva_getxoptattr(xvap);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 ASSERT3P(xoap, !=3D, NULL);<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0ASSERT_VOP_IN_SEQC(ZTOV(zp));<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (zp->z_zfsvfs->z_replay =3D= =3D B_FALSE) {<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ASSERT_= VOP_IN_SEQC(ZTOV(zp));<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (XVA_ISSET_REQ(xvap, XAT_CREATET= IME)) {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_= t times[2];<br> diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c<br> index 8fe1cc30ba99..f81b9540a639 100644<br> --- a/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c<br> +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-cred.c<br> @@ -128,7 +128,7 @@ groupmember(gid_t gid, const cred_t *cr)<br= > =C2=A0uid_t<br> =C2=A0crgetuid(const cred_t *cr)<br> =C2=A0{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->euid));= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->fsuid))= ;<br> =C2=A0}<br> <br> =C2=A0/* Return the real user id */<br> @@ -138,44 +138,9 @@ crgetruid(const cred_t *cr)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (KUID_TO_SUID(cr->uid));<= br> =C2=A0}<br> <br> -/* Return the saved user id */<br> -uid_t<br> -crgetsuid(const cred_t *cr)<br> -{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->suid));= <br> -}<br> -<br> -/* Return the filesystem user id */<br> -uid_t<br> -crgetfsuid(const cred_t *cr)<br> -{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KUID_TO_SUID(cr->fsuid))= ;<br> -}<br> -<br> =C2=A0/* Return the effective group id */<br> =C2=A0gid_t<br> =C2=A0crgetgid(const cred_t *cr)<br> -{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->egid));= <br> -}<br> -<br> -/* Return the real group id */<br> -gid_t<br> -crgetrgid(const cred_t *cr)<br> -{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->gid));<= br> -}<br> -<br> -/* Return the saved group id */<br> -gid_t<br> -crgetsgid(const cred_t *cr)<br> -{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0return (KGID_TO_SGID(cr->sgid));= <br> -}<br> -<br> -/* Return the filesystem group id */<br> -gid_t<br> -crgetfsgid(const cred_t *cr)<br> =C2=A0{<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (KGID_TO_SGID(cr->fsgid))= ;<br> =C2=A0}<br> @@ -184,12 +149,7 @@ EXPORT_SYMBOL(crhold);<br> =C2=A0EXPORT_SYMBOL(crfree);<br> =C2=A0EXPORT_SYMBOL(crgetuid);<br> =C2=A0EXPORT_SYMBOL(crgetruid);<br> -EXPORT_SYMBOL(crgetsuid);<br> -EXPORT_SYMBOL(crgetfsuid);<br> =C2=A0EXPORT_SYMBOL(crgetgid);<br> -EXPORT_SYMBOL(crgetrgid);<br> -EXPORT_SYMBOL(crgetsgid);<br> -EXPORT_SYMBOL(crgetfsgid);<br> =C2=A0EXPORT_SYMBOL(crgetngroups);<br> =C2=A0EXPORT_SYMBOL(crgetgroups);<br> =C2=A0EXPORT_SYMBOL(groupmember);<br> diff --git a/sys/contrib/openzfs/module/os/linux/zfs/policy.c b/sys/contrib/openzfs/module/os/linux/zfs/policy.c<br> index bbccb2e572d9..5a52092bb90a 100644<br> --- a/sys/contrib/openzfs/module/os/linux/zfs/policy.c<br> +++ b/sys/contrib/openzfs/module/os/linux/zfs/policy.c<br> @@ -121,7 +121,7 @@ secpolicy_vnode_access2(const cred_t *cr, struct inode *ip, uid_t owner,<br> =C2=A0int<br> =C2=A0secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)<br> =C2=A0{<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0if (crgetfsuid(cr) =3D=3D owner)<br= > +=C2=A0 =C2=A0 =C2=A0 =C2=A0if (crgetuid(cr) =3D=3D owner)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return = (0);<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (zpl_inode_owner_or_capable(kcre= d->user_ns, ip))<br> @@ -147,7 +147,7 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)<br> =C2=A0int<br> =C2=A0secpolicy_vnode_chown(const cred_t *cr, uid_t owner)<br> *** 141 LINES SKIPPED ***<br> </blockquote> </div> </blockquote> </body> </html> --------------T225G4Nw6RIGdwrkSz1AebTw--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0712c3eb-0a36-c3f0-a8da-aef99a0cb363>