From owner-freebsd-fs@FreeBSD.ORG Tue Mar 2 11:10:58 2004 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C6EE516A4CE for ; Tue, 2 Mar 2004 11:10:58 -0800 (PST) Received: from mx.nsu.ru (mx.nsu.ru [212.192.164.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3E24C43D3F for ; Tue, 2 Mar 2004 11:10:58 -0800 (PST) (envelope-from fjoe@iclub.nsu.ru) Received: from iclub.nsu.ru ([193.124.215.97] ident=root) by mx.nsu.ru with esmtp (Exim 4.30) id 1AyFKN-0002at-Cb; Wed, 03 Mar 2004 01:13:15 +0600 Received: from iclub.nsu.ru (fjoe@localhost [127.0.0.1]) by iclub.nsu.ru (8.12.10/8.12.10) with ESMTP id i22JAuYw039809; Wed, 3 Mar 2004 01:10:56 +0600 (NS) (envelope-from fjoe@iclub.nsu.ru) Received: (from fjoe@localhost) by iclub.nsu.ru (8.12.10/8.12.10/Submit) id i22JAuno039808; Wed, 3 Mar 2004 01:10:56 +0600 (NS) (envelope-from fjoe) Date: Wed, 3 Mar 2004 01:10:55 +0600 From: Max Khon To: rjshang Message-ID: <20040302191055.GA39744@iclub.nsu.ru> References: <20040213091617.M29405@synology.com> <20040302190838.GB38981@iclub.nsu.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <20040302190838.GB38981@iclub.nsu.ru> User-Agent: Mutt/1.4.1i cc: freebsd-fs@freebsd.org Subject: Re: Is that a typo in ffs_softdep.c X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2004 19:10:58 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello! On Wed, Mar 03, 2004 at 01:08:38AM +0600, Max Khon wrote: > > It looks like a typo in ffs_softdep.c softdep_sync_metadata(). > > The second parameter of drain_output is used to tell if it is > > protected by &lk. > > Is there other concern? > > Please check the following patch from 4.9 release. [...] > Nice catch! > > drain_output() should be called earlier (before chechkig dirty list). > The bug was introduced in ffs_softdep.c rev. 1.57.2.10. > Correct patch is attached. > I sent this patch to Kirk for review and will commit it as soon as I get > an approval from him. Sorry, forgot to attach the patch. /fjoe --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ffs_softdep.c.diff" Index: ffs_softdep.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_softdep.c,v retrieving revision 1.57.2.11 diff -u -p -r1.57.2.11 ffs_softdep.c --- ffs_softdep.c 5 Feb 2002 18:46:53 -0000 1.57.2.11 +++ ffs_softdep.c 2 Mar 2004 18:52:25 -0000 @@ -4293,7 +4293,11 @@ loop: * If we have managed to get rid of all the dirty buffers, * then we are done. For certain directories and block * devices, we may need to do further work. + * + * We must wait for any I/O in progress to finish so that + * all potential buffers on the dirty list will be visible. */ + drain_output(vp, 1); if (TAILQ_FIRST(&vp->v_dirtyblkhd) == NULL) { FREE_LOCK(&lk); return (0); @@ -4306,11 +4310,7 @@ loop: * partially written files have been written to disk. The only easy * way to accomplish this is to sync the entire filesystem (luckily * this happens rarely). - * - * We must wait for any I/O in progress to finish so that - * all potential buffers on the dirty list will be visible. */ - drain_output(vp, 1); if (vn_isdisk(vp, NULL) && vp->v_specmountpoint && !VOP_ISLOCKED(vp, NULL) && (error = VFS_SYNC(vp->v_specmountpoint, MNT_WAIT, ap->a_cred, --/04w6evG8XlLl3ft--