Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Dec 2008 09:06:11 -0800
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "David E. O'Brien" <obrien@FreeBSD.org>
Subject:   Re: svn: head/usr.sbin/burncd
Message-ID:  <494D2603.9000001@FreeBSD.org>
In-Reply-To: <20081220115505.GZ2038@deviant.kiev.zoral.com.ua>
References:  <200812192020.mBJKKEIo081792@svn.freebsd.org> <494C097C.1020604@FreeBSD.org> <20081220115505.GZ2038@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Kostik Belousov wrote:
> On Fri, Dec 19, 2008 at 12:52:12PM -0800, Maxim Sobolev wrote:
>> Should not it be better to implement this on the kernel side when the 
>> device is closed abruptly?
> The state that is kept is not accumulated on any particular filedescriptor,
> it is associated with the physical state of the device.
> 
> Therefore, I think that kernel shall not be charged with cleanup, and
> userspace calls should deal with resetting device back to the pristine
> state.

It may not be associated with any particular descriptor, still you can 
count number of opens for write compared to count of closes in the 
kernel. And it should be trivial to track when this number goes down to 
0 and clean up any leftover mess. Check dev/md/md.c for example, 
function g_md_access().

-Maxim



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