Re: Patch for rc.d/devd on FreeBSD 9-current

From: Dag-Erling Smørgrav <des_at_des.no>
Date: Mon, 28 Jun 2010 10:38:29 +0200
Dag-Erling Smørgrav <des_at_des.no> writes:

> "M. Warner Losh" <imp_at_bsdimp.com> writes:
>> Maybe the real problem is that devd locks the file, then dies.  The
>> file remains locked, so the flopen is failing with EWOULDBLOCK.
>
> The lock is released when the process that holds it terminates.
>
>> But I suspect the real real problem is the implicit assumption that
>> flock will release the lock when a process terminates...  That isn't
>> the case in BSD
> Yes it is.

Additional details:

 - Under POSIX semantics (fcntl(2) locks), the lock is released when
   *any* file descriptor the process holds for that file is closed.
   This is handled in fdfree().

 - Under flock semantics (flock(2) locks), the lock is released when
   *all* file descriptors the process holds for that file is closed.
   This is handled in vn_closefile().

 - In both cases, all locks a process holds are released when the
   process terminates.

Gotta love the following excerpt from VOP_OPEN(9), btw:

  The VOP_OPEN() entry point is called before a file is accessed by a
  process and the VOP_CLOSE() entry point is called after a file is fin‐
  ished with by the process.

:)

DES
-- 
Dag-Erling Smørgrav - des_at_des.no
Received on Mon Jun 28 2010 - 06:40:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:05 UTC