From owner-svn-src-head@freebsd.org Thu Feb 15 23:16:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 319B7F22F0C; Thu, 15 Feb 2018 23:16:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6F6A758C8; Thu, 15 Feb 2018 23:16:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 18DDC10AFAD; Thu, 15 Feb 2018 18:16:24 -0500 (EST) From: John Baldwin To: Alan Somers Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329265 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Date: Thu, 15 Feb 2018 11:18:15 -0800 Message-ID: <3148002.4yJvN52HMT@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201802141549.w1EFnVBV064848@repo.freebsd.org> References: <201802141549.w1EFnVBV064848@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 15 Feb 2018 18:16:24 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 23:16:31 -0000 On Wednesday, February 14, 2018 03:49:31 PM Alan Somers wrote: > Author: asomers > Date: Wed Feb 14 15:49:31 2018 > New Revision: 329265 > URL: https://svnweb.freebsd.org/changeset/base/329265 > > Log: > Implement .vop_pathconf and .vop_getacl for the .zfs ctldir > > zfsctl_common_pathconf will report all the same variables that regular ZFS > volumes report. zfsctl_common_getacl will report an ACL equivalent to 555, > except that you can't read xattrs or edit attributes. > > Fixes a bug where "ls .zfs" will occasionally print something like: > ls: .zfs/.: Operation not supported > > PR: 225793 > Reviewed by: avg > MFC after: 3 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D14365 > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Wed Feb 14 15:40:13 2018 (r329264) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Wed Feb 14 15:49:31 2018 (r329265) > @@ -80,6 +80,10 @@ > > #include "zfs_namecheck.h" > > +/* Common access mode for all virtual directories under the ctldir */ > +const u_short zfsctl_ctldir_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | > + S_IROTH | S_IXOTH; > + > /* > * "Synthetic" filesystem implementation. > */ > @@ -496,8 +500,7 @@ zfsctl_common_getattr(vnode_t *vp, vattr_t *vap) > vap->va_nblocks = 0; > vap->va_seq = 0; > vn_fsid(vp, vap); > - vap->va_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | > - S_IROTH | S_IXOTH; > + vap->va_mode = zfsctl_ctldir_mode; > vap->va_type = VDIR; > /* > * We live in the now (for atime). > @@ -724,6 +727,87 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap) > return (0); > } > > +static int > +zfsctl_common_pathconf(ap) > + struct vop_pathconf_args /* { > + struct vnode *a_vp; > + int a_name; > + int *a_retval; > + } */ *ap; > +{ > + /* > + * We care about ACL variables so that user land utilities like ls > + * can display them correctly. Since the ctldir's st_dev is set to be > + * the same as the parent dataset, we must support all variables that > + * it supports. > + */ > + switch (ap->a_name) { > + case _PC_LINK_MAX: > + *ap->a_retval = INT_MAX; > + return (0); On HEAD this should probably match the existing ZFS pathconf (min(LONG_MAX, ZFS_LINK_MAX IIRC), though if these directories can only ever have a link count of 2 (which seems true from zfsctl_common_getattr()) then it would be fine to return '2' here instead. For stable you'd have to restrict it to LINK_MAX if you don't use '2'. Also, you should call vfs_stdpathconf() in the default: case. -- John Baldwin