From owner-svn-src-all@FreeBSD.ORG Fri Nov 20 22:22:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC40D106568D; Fri, 20 Nov 2009 22:22:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A1D68FC0A; Fri, 20 Nov 2009 22:22:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKMMrZH058052; Fri, 20 Nov 2009 22:22:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKMMr9J058050; Fri, 20 Nov 2009 22:22:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200911202222.nAKMMr9J058050@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 20 Nov 2009 22:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199617 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2009 22:22:53 -0000 Author: kib Date: Fri Nov 20 22:22:53 2009 New Revision: 199617 URL: http://svn.freebsd.org/changeset/base/199617 Log: On the return path from F_RDAHEAD and F_READAHEAD fcntls, do not unlock Giant twice. While there, bring conditions in the do/while loops closer to style, that also makes the lines fit into 80 columns. Reported and tested by: dougb Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Nov 20 21:21:13 2009 (r199616) +++ head/sys/kern/kern_descrip.c Fri Nov 20 22:22:53 2009 (r199617) @@ -718,14 +718,15 @@ kern_fcntl(struct thread *td, int fd, in do { new = old = fp->f_flag; new |= FRDAHEAD; - } while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0); + } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); readahead_vnlock_fail: VFS_UNLOCK_GIANT(vfslocked); + vfslocked = 0; } else { do { new = old = fp->f_flag; new &= ~FRDAHEAD; - } while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0); + } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); } fdrop(fp, td); break;