Date: Wed, 28 Jun 2006 22:51:43 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100240 for review Message-ID: <200606282251.k5SMph3v070076@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100240 Change 100240 by kmacy@kmacy_storage:sun4v_work_sleepq on 2006/06/28 22:50:47 fix an LOR with Giant in fcntl Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/kern/kern_descrip.c#10 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/kern/kern_descrip.c#10 (text+ko) ==== @@ -365,18 +365,24 @@ flg = F_POSIX; p = td->td_proc; fdp = p->p_fd; + retry: FILEDESC_LOCK(fdp); if ((unsigned)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) { FILEDESC_UNLOCK(fdp); + if (giant_locked) + mtx_unlock(&Giant); error = EBADF; goto done2; } pop = &fdp->fd_ofileflags[fd]; - if ((fp->f_ops->fo_flags & DFLAG_MPSAFE) == 0) { + if ((giant_locked == 0) && ((fp->f_ops->fo_flags & DFLAG_MPSAFE) == 0)) { + FILEDESC_UNLOCK(fdp); mtx_lock(&Giant); giant_locked = 1; + /* we may have lost a race */ + goto retry; } switch (cmd) { case F_DUPFD:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606282251.k5SMph3v070076>