Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 16:26:28 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Jaakko Heinonen <jh@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r206560 - head/sys/fs/devfs
Message-ID:  <20100415132628.GE2415@deviant.kiev.zoral.com.ua>
In-Reply-To: <20100415130155.GA3017@a91-153-117-195.elisa-laajakaista.fi>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--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/--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100415132628.GE2415>