Print this page
OS-5591 Double flock(3C) causes undue block
OS-5585 fcntl(F_OFD_GETLK) should return EINVAL on bad parameters
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>

*** 521,534 **** * file will drop the lock (e.g. lock /etc/passwd, call a library function * which opens /etc/passwd to read the file, when the library closes it's * file descriptor the application loses its lock and does not know). * 2) Locks are not preserved across fork(2). * ! * Because these locks are only assoiciated with a pid they are per-process. ! * This is why any close will drop the lock and is also why once the process ! * forks then the lock is no longer related to the new process. These locks can ! * be considered as pid-ful. * * See ofdlock() for the implementation of a similar but improved locking * scheme. */ int --- 521,534 ---- * file will drop the lock (e.g. lock /etc/passwd, call a library function * which opens /etc/passwd to read the file, when the library closes it's * file descriptor the application loses its lock and does not know). * 2) Locks are not preserved across fork(2). * ! * Because these locks are only associated with a PID, they are per-process. ! * This is why any close will drop the lock and is also why, once the process ! * forks, the lock is no longer related to the new process. These locks can ! * be considered as PID-ful. * * See ofdlock() for the implementation of a similar but improved locking * scheme. */ int
*** 1001,1011 **** { file_t *fp; ASSERT(IS_DEAD(lock)); ! if ((fp = lock->l_ofd) != NULL) fp->f_filock = NULL; if (IS_REFERENCED(lock)) { lock->l_state |= DELETED_LOCK; return; --- 1001,1011 ---- { file_t *fp; ASSERT(IS_DEAD(lock)); ! if ((fp = lock->l_ofd) != NULL && fp->f_filock == (struct filock *)lock) fp->f_filock = NULL; if (IS_REFERENCED(lock)) { lock->l_state |= DELETED_LOCK; return;