Date: Wed, 3 Mar 2004 01:10:55 +0600 From: Max Khon <fjoe@iclub.nsu.ru> To: rjshang <rjshang@synology.com> Cc: freebsd-fs@freebsd.org Subject: Re: Is that a typo in ffs_softdep.c Message-ID: <20040302191055.GA39744@iclub.nsu.ru> In-Reply-To: <20040302190838.GB38981@iclub.nsu.ru> References: <20040213091617.M29405@synology.com> <20040302190838.GB38981@iclub.nsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
--/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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040302191055.GA39744>
