Source-Changes-HG archive

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

[src/trunk]: src Remove a vnode reference leak from msdosfs_rename. Release t...



details:   https://anonhg.NetBSD.org/src/rev/aab5d91885c0
branches:  trunk
changeset: 763439:aab5d91885c0
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Mar 19 20:05:21 2011 +0000

description:
Remove a vnode reference leak from msdosfs_rename. Release tdvp if either
doscheckpath() or relookup() fails.

Adjust test fs/vfs/t_vnops.c and remove the link count test for msdos.

Fixes PR #44661

diffstat:

 sys/fs/msdosfs/msdosfs_vnops.c |  9 ++++-----
 tests/fs/vfs/t_vnops.c         |  8 +++-----
 2 files changed, 7 insertions(+), 10 deletions(-)

diffs (66 lines):

diff -r e4d768d9fea9 -r aab5d91885c0 sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c    Sat Mar 19 19:54:02 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c    Sat Mar 19 20:05:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.72 2011/03/03 08:10:45 pooka Exp $ */
+/*     $NetBSD: msdosfs_vnops.c,v 1.73 2011/03/19 20:05:21 hannken Exp $       */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.72 2011/03/03 08:10:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.73 2011/03/19 20:05:21 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -935,11 +935,11 @@
                 */
                vref(tdvp);
                if ((error = doscheckpath(ip, dp)) != 0)
-                       goto out;
+                       goto bad;
                vn_lock(tdvp, LK_EXCLUSIVE | LK_RETRY);
                if ((error = relookup(tdvp, &tvp, tcnp, 0)) != 0) {
                        VOP_UNLOCK(tdvp);
-                       goto out;
+                       goto bad;
                }
                dp = VTODE(tdvp);
                xp = tvp ? VTODE(tvp) : NULL;
@@ -1114,7 +1114,6 @@
        if (tvp)
                vput(tvp);
        vrele(tdvp);
-out:
        ip->de_flag &= ~DE_RENAME;
        vrele(fdvp);
        vrele(fvp);
diff -r e4d768d9fea9 -r aab5d91885c0 tests/fs/vfs/t_vnops.c
--- a/tests/fs/vfs/t_vnops.c    Sat Mar 19 19:54:02 2011 +0000
+++ b/tests/fs/vfs/t_vnops.c    Sat Mar 19 20:05:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_vnops.c,v 1.21 2011/03/03 10:57:30 pooka Exp $       */
+/*     $NetBSD: t_vnops.c,v 1.22 2011/03/19 20:05:21 hannken Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -290,14 +290,12 @@
        RL(rump_sys_rename(pb2, pb3));
 
        RL(rump_sys_stat(pb1, &sb));
-       ATF_CHECK_EQ(sb.st_nlink, 3);
+       if (! FSTYPE_MSDOS(tc))
+               ATF_CHECK_EQ(sb.st_nlink, 3);
        RL(rump_sys_rmdir(pb3));
        if (FSTYPE_TMPFS(tc))
                atf_tc_expect_signal(-1, "PR kern/44288");
        RL(rump_sys_rmdir(pb1));
-
-       if (FSTYPE_MSDOS(tc))
-               atf_tc_expect_fail("PR kern/44661");
 }
 
 static void



Home | Main Index | Thread Index | Old Index