From owner-p4-projects@FreeBSD.ORG Thu Jun 29 04:11:33 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4923916A47B; Thu, 29 Jun 2006 04:11:33 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2427E16A40F for ; Thu, 29 Jun 2006 04:11:33 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C8B7F43D5A for ; Thu, 29 Jun 2006 04:11:32 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5T4BWO4000514 for ; Thu, 29 Jun 2006 04:11:32 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5T4BWuM000511 for perforce@freebsd.org; Thu, 29 Jun 2006 04:11:32 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 29 Jun 2006 04:11:32 GMT Message-Id: <200606290411.k5T4BWuM000511@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 100257 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2006 04:11:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=100257 Change 100257 by kmacy@kmacy_storage:sun4v_work_stable on 2006/06/29 04:10:44 fix an LOR with Giant in fcntl Affected files ... .. //depot/projects/kmacy_sun4v_stable/src/sys/kern/kern_descrip.c#4 integrate Differences ... ==== //depot/projects/kmacy_sun4v_stable/src/sys/kern/kern_descrip.c#4 (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: