From owner-svn-src-all@FreeBSD.ORG Thu Apr 15 13:26:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCCFC1065672; Thu, 15 Apr 2010 13:26:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 697D98FC1B; Thu, 15 Apr 2010 13:26:32 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o3FDQSUP050415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Apr 2010 16:26:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o3FDQS3r033642; Thu, 15 Apr 2010 16:26:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o3FDQS5h033641; Thu, 15 Apr 2010 16:26:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 15 Apr 2010 16:26:28 +0300 From: Kostik Belousov To: Jaakko Heinonen Message-ID: <20100415132628.GE2415@deviant.kiev.zoral.com.ua> References: <201004131853.o3DIrdOT035078@svn.freebsd.org> <20100414084037.GK2415@deviant.kiev.zoral.com.ua> <20100414124912.GA2950@a91-153-117-195.elisa-laajakaista.fi> <20100414130343.GO2415@deviant.kiev.zoral.com.ua> <20100414141959.GA3276@a91-153-117-195.elisa-laajakaista.fi> <20100414154248.GR2415@deviant.kiev.zoral.com.ua> <20100415130155.GA3017@a91-153-117-195.elisa-laajakaista.fi> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RQwN4daKXWcbejL/" Content-Disposition: inline In-Reply-To: <20100415130155.GA3017@a91-153-117-195.elisa-laajakaista.fi> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206560 - head/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Apr 2010 13:26:34 -0000 --RQwN4daKXWcbejL/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 15, 2010 at 04:01:56PM +0300, Jaakko Heinonen wrote: > On 2010-04-14, Kostik Belousov wrote: > > First, I think we shall sort dirent->dd_dlist so that symlinks are > > located before any other entries, and allow for duplication of > > any name with the name of symlink. >=20 > What will happen when user deletes a symlink covering a device? > Uncovering the device may a bit surprising? If user created directories > will be allowed one day, they will face the same problem. Yes, device will be uncovered if it is there, the same with the directory. Use case I have in mind when I wrote this is the following: assume we have devices named dev1 and dev2, and two jails, j1 and j2, each with its own devfs mount. Also, assume that some program A has hardcoded /dev/dev1 as the name of device to operate, and it is run both in j1 and j2. Further, j1 is given access to /dev/dev1 only, while j2 is given access to /dev/dev2 only. Then administrator of j1 can create a symlink /dev/dev -> dev1, while administrator of j2 symlinks /dev/dev ->dev2, and both j1 and j2 would operate properly. This is not that perversed as it sounds, I think it is an essence of symlink usage on devfs. >=20 > > I remember there was a PR to change devfs_symlink() so that symlink is > > added to dd_dlist into head, not to a tail, as it is done now. >=20 > kern/114057 >=20 > > Assume that all full devfs pathes except symlinks are stored somewhere > > with type information for the component at the end. > > Then, just iterating this set at make_dev() time, we can verify that > > name is not a duplicate, and that the path components are not already > > used as device name (only as directories). > > The pathes storage need to be protected by dev_mtx.=20 > >=20 > > Possibly, the cdev_priv.c_dev.__si_namebuf may be reused at the > > cost of long check at the make_dev() time. >=20 > Could you elaborate on this? I am not sure if I understand what you mean > with __si_namebuf reuse. I mean that we do not to create the structure that mirrors the directory/no= des hierarchy for devfs dirents, but can dynamically parse __si_namebuf at the make_dev() time, iterating over all nodes using cdevp_list. For symlinks, it seems the easiest route is to have separate ref-counted structures containing the pathes for owning directories. >=20 > > What do you think of this ? >=20 > I don't see anything obviously wrong with it. >=20 > --=20 > Jaakko --RQwN4daKXWcbejL/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkvHFAMACgkQC3+MBN1Mb4gTSwCgpRgYstpHdZl967cwjRk3JvKK TF8AoJKdJfcBSHJsILcn3WGRQ3yV2Dez =Pe7P -----END PGP SIGNATURE----- --RQwN4daKXWcbejL/--