Date: Wed, 26 Sep 2007 22:40:06 GMT From: Kris Kennaway <kris@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/94256: [nfs] nfs locking/rpc.lockd doesn't understand file descriptor sharing Message-ID: <200709262240.l8QMe6Ex031022@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/94256; it has been noted by GNATS. From: Kris Kennaway <kris@FreeBSD.org> To: Zachary Loafman <zachary.loafman@isilon.com> Cc: bug-followup@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709262240.l8QMe6Ex031022>
