Subject: Re: Handling of device special files in BSD vnode/vfs
To: Vasanth Kanchan <Vasanth_Kanchan@s3.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 03/03/1997 18:00:57
> The vnode/vfs code prevents opening of device special files if it is
> mounted or prevents mounting of the file if it has been opened.
> However consider the case where 2 different file names either on the
> same filesystem or different filesystem map to the same device. If
> these files are opened, the read/write will be cached through their
> repective vnode's with unpredictable results. Is this correct ?
> What does checkaliases() do?
Fix this very problem. :-) In kern/vfs_subr.c, the comment says
* Check to see if the new vnode represents a special device
* for which we already have a vnode (either because of
* bdevvp() or because of a different vnode representing
* the same block device). If such an alias exists, deallocate
* the existing contents and return the aliased vnode. The
* caller is responsible for filling it with its new contents.
(by the way, it's checkalias, not checkaliases, at least in 1.2.) The
comment is slightly inaccurate in that it appears to work for character
devices as well as block devices.
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B