I don't know much (anything) about the advisory locking code, but was
puzzled to see the following at the bottom of the flock() system call code
in kern_descrip.c:

        if (uap->how & LOCK_EX)
                lf.l_type = F_WRLCK;
        else if (uap->how & LOCK_SH)
                lf.l_type = F_RDLCK;
        else {
                error = EBADF;
                goto done2;
        fp->f_flag |= FHASLOCK;
        error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
            (uap->how & LOCK_NB) ? F_FLOCK : F_FLOCK | F_WAIT);
        fdrop(fp, td);
        return (error);

My reading of that is that the fp->f_flag field will be unconditionally
updated to include FHASLOCK, even if VOP_ADVLOCK() returns an error.  Is
this correct?

Robert N M Watson             FreeBSD Core Team, TrustedBSD Project
[EMAIL PROTECTED]      NAI Labs, Safeport Network Services

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to