From owner-cvs-src@FreeBSD.ORG Sat May 31 23:24:33 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2302937B401; Sat, 31 May 2003 23:24:33 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C766F43F85; Sat, 31 May 2003 23:24:32 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h516OW0U097170; Sat, 31 May 2003 23:24:32 -0700 (PDT) (envelope-from truckman@repoman.freebsd.org) Received: (from truckman@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h516OWX5097169; Sat, 31 May 2003 23:24:32 -0700 (PDT) Message-Id: <200306010624.h516OWX5097169@repoman.freebsd.org> From: Don Lewis Date: Sat, 31 May 2003 23:24:32 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/fs/fifofs fifo_vnops.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jun 2003 06:24:33 -0000 truckman 2003/05/31 23:24:32 PDT FreeBSD src repository Modified files: sys/fs/fifofs fifo_vnops.c Log: Fix up locking problems in fifo_open() and fifo_close(): Sleep on the vnode interlock while waiting for another caller to increment fi_readers or fi_writers. Hold the vnode interlock while incrementing fi_readers or fi_writers to prevent a wakeup from being missed. Only access fi_readers and fi_writers while holding the vnode lock. Previously fifo_close() decremented their values without holding a lock. Move resource deallocation from fifo_close() to fifo_inactive(), which allows the VOP_CLOSE() call in the error return path in fifo_open() to be removed. Fifo_open() was calling VOP_CLOSE() with the vnode lock held, in violation the current vnode locking API. Also the way fifo_close() used vrefcnt() to decide whether to deallocate resources was bogus according to comments in the vrefcnt() implementation. Reviewed by: bde Revision Changes Path 1.87 +73 -25 src/sys/fs/fifofs/fifo_vnops.c