[OpenAFS] [grand.central.org #19412] OpenAFS-1.3.85 on Solars 10 Problem with pwd after rename of a directory

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Wed, 03 Aug 2005 14:11:17 -0400


it looks like ENODEV being returned from afs_lookup() is causing the grief.

the attached patch gets getcwd "working".  its not clear to me yet what
is happening but it looks like when you have a bad mount, lookuppnvp()--
used by getcwd()--gets an error from VOP_LOOKUP() and fails.

        /*
         * Perform a lookup in the current directory.
         */
        error = VOP_LOOKUP(vp, component, &tvp, pnp, lookup_flags,
                rootvp, cr);
        cvp = tvp;
        if (error) {
                cvp = NULL;
                /*
                 * On error, return hard error if
                 * (a) we're not at the end of the pathname yet, or
                 * (b) the caller didn't want the parent directory, or
                 * (c) we failed for some reason other than a missing entry.
                 */
                if (pn_pathleft(pnp) || dirvpp == NULL || error != ENOENT)
                        goto bad;

its seems that getcwd moved into the kernel in solaris10.  in earlier
versions getcwd seemed to be in a userspace library.

Index: src/afs/VNOPS/afs_vnop_lookup.c
===================================================================
RCS file: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v
retrieving revision 1.50.2.6
diff -u -u -r1.50.2.6 afs_vnop_lookup.c
--- src/afs/VNOPS/afs_vnop_lookup.c	31 Jan 2005 03:49:15 -0000	1.50.2.6
+++ src/afs/VNOPS/afs_vnop_lookup.c	3 Aug 2005 18:00:41 -0000
@@ -1198,7 +1198,7 @@
 
     /* Check for read access as well.  We need read access in order to
      * stat files, but not to stat subdirectories. */
-    if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS))
+    if (!afs_AccessOK(adp, PRSFS_READ, &treq, CHECK_MODE_BITS))
 	no_read_access = 1;
 
     /* special case lookup of ".".  Can we check for it sooner in this code,
@@ -1578,5 +1578,9 @@
     }
 
     afs_PutFakeStat(&fakestate);
+if (code == ENODEV) {
+	printf("afs_lookup() would have return ENODEV; returning ENOENT\n");
+	code = ENOENT;
+}
     return code;
 }