[CFR] devfs improvements

From: Jaakko Heinonen <jh_at_FreeBSD.org>
Date: Mon, 19 Jul 2010 18:00:46 +0300
Hi,

I have been working on some devfs improvements and I am now posting the
patch for wider review and testing. Especially testing from people using
multiple devfs mounts and/or symbolic links would be useful.

The patch:

	http://people.freebsd.org/~jh/patches/devfs.7.diff

Notable changes:

- Automatically remove empty directories.
- Allow user created symbolic links to cover device files and
  directories if the device file appears after the link creation.
- It's now possible to report if the device file already exists or is
  invalid to make_dev_credf(9) and make_dev_p(9) callers. There
  is a new flag MAKEDEV_CHECKNAME to indicate that the caller is
  prepared to handle such error. If the flag is not specified and the
  device name is invalid, a panic will occur. This code is not yet
  enabled because there are some driver issues which need to be sorted
  out before. (See "#ifdef notyet" in make_dev_credv().) 

In addition the patch should fix these bugs:

- kern/114057
- fstat(2) could return stale information through open file descriptors.

My main motivation for these changes was erratic handling of duplicate
and invalid device names. For example currently you can crash the system
through geom_label by inserting a specially crafted CD. Driver bugs
causing duplicate device registrations weren't detected either.

Most of the ideas implemented in the patch are from Kostik Belousov.
Special thanks for him providing help and reviews during the
development.

Additional patches:

A patch for GEOM to convert g_dev_taste() to use make_dev_p() with
MAKEDEV_CHECKNAME flag instead of make_dev().

	http://people.freebsd.org/~jh/patches/geom_dev-checkname.diff

Enable panicking on invalid device names:

	http://people.freebsd.org/~jh/patches/make_dev-checkname.diff

-- 
Jaakko
Received on Mon Jul 19 2010 - 13:00:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:05 UTC