kern/94256: [nfs] nfs locking/rpc.lockd doesn't understand file
descriptor sharing
Kris Kennaway
kris at FreeBSD.org
Wed Sep 26 15:40:06 PDT 2007
The following reply was made to PR kern/94256; it has been noted by GNATS.
From: Kris Kennaway <kris at FreeBSD.org>
To: Zachary Loafman <zachary.loafman at isilon.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: kern/94256: [nfs] nfs locking/rpc.lockd doesn't understand file
descriptor sharing
Date: Thu, 27 Sep 2007 00:31:26 +0200
Zachary Loafman wrote:
> I'm a little confused here.
>
> >For example, a process may lock a file, fork, and
> >the child process inherits the file descriptor table and may
> >legitimately unlock the file.
>
> Uh, no:
>
> "File locks set by the parent process are not inherited by the child
> process." (http://www.opengroup.org/onlinepubs/007908799/xsh/fork.html)
Well FreeBSD supports it and in fact uses it in e.g. the pidfile() code
used by at least one daemon (I forget which). pidfile locks the file,
the process forks the daemon, then later it is unlocked in the child. I
am not sure if you can also do the same thing by passing a file
descriptor with sendmsg() and then unlocking it.
You do make a case that this behaviour should not be allowed though.
Kris
More information about the freebsd-bugs
mailing list