Source-Changes-HG archive

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

[src/trunk]: src Fix file handle operations for tmpfs by removing a now bogus...



details:   https://anonhg.NetBSD.org/src/rev/841f56532482
branches:  trunk
changeset: 763748:841f56532482
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Apr 02 14:24:53 2011 +0000

description:
Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed.  Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)

diffstat:

 sys/fs/tmpfs/tmpfs_vfsops.c |   9 +++------
 tests/fs/vfs/t_vfsops.c     |  11 +----------
 2 files changed, 4 insertions(+), 16 deletions(-)

diffs (76 lines):

diff -r b2742d35f0d4 -r 841f56532482 sys/fs/tmpfs/tmpfs_vfsops.c
--- a/sys/fs/tmpfs/tmpfs_vfsops.c       Sat Apr 02 12:53:32 2011 +0000
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c       Sat Apr 02 14:24:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vfsops.c,v 1.46 2010/06/26 03:38:14 rmind Exp $  */
+/*     $NetBSD: tmpfs_vfsops.c,v 1.47 2011/04/02 14:24:53 hannken Exp $        */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.46 2010/06/26 03:38:14 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.47 2011/04/02 14:24:53 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -278,9 +278,6 @@
 
        memcpy(&tfh, fhp, sizeof(struct tmpfs_fid));
 
-       if (tfh.tf_id >= tmp->tm_nodes_max)
-               return EINVAL;
-
        found = false;
        mutex_enter(&tmp->tm_lock);
        LIST_FOREACH(node, &tmp->tm_nodes, tn_entries) {
@@ -293,7 +290,7 @@
        mutex_exit(&tmp->tm_lock);
 
        /* XXXAD nothing to prevent 'node' from being removed. */
-       return found ? tmpfs_alloc_vp(mp, node, vpp) : EINVAL;
+       return found ? tmpfs_alloc_vp(mp, node, vpp) : ESTALE;
 }
 
 /* --------------------------------------------------------------------- */
diff -r b2742d35f0d4 -r 841f56532482 tests/fs/vfs/t_vfsops.c
--- a/tests/fs/vfs/t_vfsops.c   Sat Apr 02 12:53:32 2011 +0000
+++ b/tests/fs/vfs/t_vfsops.c   Sat Apr 02 14:24:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_vfsops.c,v 1.9 2011/01/07 12:01:11 pooka Exp $       */
+/*     $NetBSD: t_vfsops.c,v 1.10 2011/04/02 14:24:53 hannken Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -108,11 +108,6 @@
 
        /* open file based on file handle */
        fd = rump_sys_fhopen(fhp, fhsize, O_RDONLY);
-       if (FSTYPE_TMPFS(tc)) {
-               atf_tc_expect_fail("PR kern/43605");
-               if (fd != -1 || errno != EINVAL)
-                       atf_tc_expect_pass();
-       }
        if (fd == -1) {
                atf_tc_fail_errno("fhopen");
        }
@@ -154,8 +149,6 @@
        if (FSTYPE_MSDOS(tc) || FSTYPE_LFS(tc))
                atf_tc_expect_fail("fhopen() for removed file succeeds "
                    "(PR kern/43745)");
-       if (FSTYPE_TMPFS(tc))
-               atf_tc_expect_fail("PR kern/43605");
        ATF_REQUIRE_ERRNO(ESTALE, rump_sys_fhopen(fhp, fhsize, O_RDONLY) == -1);
        atf_tc_expect_pass();
 
@@ -175,8 +168,6 @@
        unsigned long seed;
        int fd;
 
-       /* XXX: this test succeeds "accidentally" on tmpfs, PR kern/43605 */
-
        srandom(seed = time(NULL));
        printf("RNG seed %lu\n", seed);
 



Home | Main Index | Thread Index | Old Index