From owner-svn-src-all@freebsd.org Fri Feb 16 16:38:49 2018 Return-Path: Delivered-To: svn-src-all@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 9BED2F2346F; Fri, 16 Feb 2018 16:38:49 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 739D584640; Fri, 16 Feb 2018 16:38:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x230.google.com with SMTP id f136so4824214lff.8; Fri, 16 Feb 2018 08:38:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=9papF+cGJvCk+mNDp5UJdF2GIVU8zFxYGnfOQbNSEJI=; b=lK1g3DjgSargBW1ZgENZKTh3XUhKNzoN/n/RqGn844xT7p095eCbeiFbfovQ/GSBUK YnKU/AyBU27WLPiRAYRKLoIi9D+QDZ7IJO6mQLWi0VVbFReDhNDP3cfWIGhVLL+20HoH uOOuIVNbW3YkpBmPox7nKT9LGZKC4V2Dt7cdrtecm0TfYoNff7Jyu1f22mgEReBBJP7B TtwpTDvI08L6PsPk/Seoq54Civ2i8CQXtoqQRolaXLEFIx9E6jar2tyB/j0nDJM0MfGN UkiF6D8tcfsXaW2v9tdzRF0//+dH34KOH6wJBgb5+tQuGhDCjbbcUY3oP8Ib6NHmINQx pMtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9papF+cGJvCk+mNDp5UJdF2GIVU8zFxYGnfOQbNSEJI=; b=DMSTWEzErSAxULQ3q7eTP7Cfsi8usTl+0CKhm7OPSJYQCWCn8emGJcDJctoAapXNso BsdQQOaaaIPtBF6gdPY+WXvbNO3v55go4xWBIRNQbdZHulOMyP1ryfCdg4VhNfsS4Te7 7C5wgvfSK9jCTPXOkRGvX3iienRTa+6YNMSlijRifZeRcCXWjykGMmmk/H6oDavGWv8q LSycPGQrqeyxlOQ4wouX5S6Z10L8aZnKsW5dUyNOO6d5MUnJHwe+xG5dDH6uUXJhVyf0 9RkvpIJ8KfiRu/v0y1l0zuK8+zkGhYPGyJ5Sb7ipwLOdopgalMNyiuh0oo4/p6sZSb4K dVKQ== X-Gm-Message-State: APf1xPB2LNF1dw8BkQtwDcLYtt1/oCXb8MjxYst7BqbUTVp2f4JqbR6G V/529YWuwgElHWE++urjdmiw2qW6b1Fa3zV/pYY= X-Google-Smtp-Source: AH8x2263kdJ0ie0gY53oD7YXFTIsomZFiMAIUZw5aCTSC5rEkvJVSjg7fZWCfv8QFIvDIwMR6klfmy1pHlkpwYHeTkU= X-Received: by 10.46.77.197 with SMTP id c66mr1278378ljd.116.1518799126576; Fri, 16 Feb 2018 08:38:46 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.35 with HTTP; Fri, 16 Feb 2018 08:38:45 -0800 (PST) In-Reply-To: <3148002.4yJvN52HMT@ralph.baldwin.cx> References: <201802141549.w1EFnVBV064848@repo.freebsd.org> <3148002.4yJvN52HMT@ralph.baldwin.cx> From: Alan Somers Date: Fri, 16 Feb 2018 09:38:45 -0700 X-Google-Sender-Auth: N-Ysu6lUti1XxtKG-9LzclcHh3s Message-ID: Subject: Re: svn commit: r329265 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 16:38:49 -0000 On Thu, Feb 15, 2018 at 12:18 PM, John Baldwin wrote: > 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 > All good points. I don't think a max link count of 2 is correct, though, because the real link count can be higher than that. See zfsctl_root_getattr and zfsctl_snapdir_getattr. I'll set it the way that zfs_pathconf does. Also, it looks like I need to add _PC_NAME_MAX. -Alan