tech-kern archive

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

broken puffs atf



Hi

I recently committeda fix that broke two puffs tests:
src/sys/kern/vfs_syscalls.c 1.451-1.454

http://releng.netbsd.org/b5reports/i386/build/2012.04.30.13.47.52/test.html#fail
ed-tcs-summary

I have trouble figuring what goes wrong. Both in mountfuzz7 and mountfuzz8, it
panics "mount: lost mount" in src/sys/kern/vfs_mount.c:mount_checkdirs()

The offending change is below. Basically, it moved from the situation where
mount_checkdirs() founds v_usecount ==1 (and it just returns) to the situation
where v_usecount  == 2 (it calls VFS_ROOT(olddp->v_mountedhere, &newdp) and
panics) 

Any suggestion on how to fix that proprely? I call vref(vp) before
mount_domount() sothat I can acccess vp->v_mountedhere after mount_domount sets
vp to NULL, but it seems this is not The Right Way.

Index: vfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.451
retrieving revision 1.454
diff -U4 -r1.451 -r1.454
--- vfs_syscalls.c      17 Apr 2012 19:15:15 -0000      1.451
+++ vfs_syscalls.c      30 Apr 2012 10:05:12 -0000      1.454
@@ -457,21 +457,32 @@
                *retval = data_len;
        } else if (flags & MNT_UPDATE) {
                error = mount_update(l, vp, path, flags, data_buf, &data_len);
        } else {
+               struct vnode *svp;
+
+               /* Save vp as mount_domount sets it to NULL */
+               vref(vp);
+               svp = vp;       
+
                /* Locking is handled internally in mount_domount(). */
                KASSERT(vfsopsrele == true);
                error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
                    &data_len);
                vfsopsrele = false;
 
                if ((error == 0) && (flags & MNT_EXTATTR)) {
-                       if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START, 
+                       KASSERT(svp->v_mountedhere != NULL);
+
+                       if (VFS_EXTATTRCTL(svp->v_mountedhere,
+                                          EXTATTR_CMD_START, 
                                           NULL, 0, NULL) != 0)
                                printf("%s: failed to start extattr",
-                                      vp->v_mount->mnt_stat.f_mntonname);
+                                    svp->v_mountedhere->mnt_stat.f_mntonname);
                                /* XXX remove flag */
                }
+
+               vrele(svp);
        }
 
     done:
        if (vfsopsrele)


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index