* Seigo Tanimura <[EMAIL PROTECTED]> [010713 07:00] wrote:
> On Fri, 13 Jul 2001 19:49:25 +0900,
> Seigo Tanimura <tanimura> said:
>
> Alfred> Certain operations, such as:
> Alfred> kq = (struct kqueue *)fp->f_data;
> Alfred> should not really require that the file be locked, it's implicitly frozen
> Alfred> at creation time (i think)
>
> Seigo> Yes.
>
> Only one exception beats off everything. union_dircheck() in
> fs/unionfs/union_subr.c may replace f_data with a new vnode.
That code really scared me, but on careful inspection, the f_data
is actually protected by the vnode exclusive lock from concurrant
getdirentries() calls. (getdirentries() calls union_dircheck())
The code is still troublesome for mixing read() and getdirentries()
at the same time, but since union mounts are rare we should leave
it along and possibly revisit this later.
My opinion is that you never need a lock for an assignment, unless
that assignment spans multiple dependant operations or is dependant
on some pre-condition, cases:
/* no lock */
foo->a = 5;
/* needs lock */
if (foo->b)
foo->a = 5;
/* might need lock to protect agianst inconsistant view */
foo->a = 5;
foo->b = c;
--
-Alfred Perlstein [[EMAIL PROTECTED]]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message