NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/38460: fstrans_start code in genfs_do_putpages is racy



On Sat, Apr 19, 2008 at 07:38:38PM +0900, YAMAMOTO Takashi wrote:
> > On Sat, Apr 19, 2008 at 08:05:00AM +0000, yamt%mwd.biglobe.ne.jp@localhost 
> > wrote:
> > > >Synopsis:       fstrans_start code in genfs_do_putpages is racy
> > 
> > This diff should fix it. Ok?
> 
> doesn't it break the existing "goto retry"?

Yes.  This one should work. Ok?

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)

Index: genfs_io.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_io.c,v
retrieving revision 1.5
diff -p -u -2 -r1.5 genfs_io.c
--- genfs_io.c  18 Jan 2008 11:01:23 -0000      1.5
+++ genfs_io.c  19 Apr 2008 11:09:28 -0000
@@ -779,7 +779,8 @@ genfs_do_putpages(struct vnode *vp, off_
            vp, uobj->uo_npages, startoff, endoff - startoff);
 
+       has_trans = false;
+
 retry:
        modified = false;
-       has_trans = false;
        flags = origflags;
        KASSERT((vp->v_iflag & VI_ONWORKLST) != 0 ||
@@ -791,4 +792,6 @@ retry:
                                vn_syncer_remove_from_worklist(vp);
                }
+               if (has_trans)
+                       fstrans_done(vp->v_mount);
                mutex_exit(slock);
                return (0);
@@ -799,5 +802,5 @@ retry:
         */
 
-       if ((flags & PGO_CLEANIT) != 0) {
+       if (!has_trans && (flags & PGO_CLEANIT) != 0) {
                mutex_exit(slock);
                if (pagedaemon) {
@@ -809,4 +812,5 @@ retry:
                has_trans = true;
                mutex_enter(slock);
+               goto retry;
        }
 
@@ -1169,7 +1173,4 @@ skip_scan:
        mutex_exit(slock);
 
-       if (has_trans)
-               fstrans_done(vp->v_mount);
-
        if ((flags & PGO_RECLAIM) != 0 && onworklst) {
                /*
@@ -1182,4 +1183,7 @@ skip_scan:
        }
 
+       if (has_trans)
+               fstrans_done(vp->v_mount);
+
        return (error);
 }


Home | Main Index | Thread Index | Old Index