darwin-avoid-hang-on-rename-20040202
authorShantonu Sen <ssen@apple.com>
Tue, 3 Feb 2004 05:10:24 +0000 (05:10 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 3 Feb 2004 05:10:24 +0000 (05:10 +0000)
FIXES 2967

this version deals with afs being multiply mounted.
return EXDEV on cross device rename attempts as upper layer doesn't deal for us

src/afs/DARWIN/osi_vnodeops.c

index d51c10c..61693c7 100644 (file)
@@ -899,6 +899,15 @@ afs_vop_rename(ap)
     register struct vnode *fdvp = ap->a_fdvp;
     struct proc *p = fcnp->cn_proc;
 
+       /* Check for cross-device rename.
+        * For AFS, this means anything not in AFS-space
+        */
+       if ((0 != strcmp(tdvp->v_mount->mnt_stat.f_fstypename, "afs")) ||
+               (tvp && (0 != strcmp(tvp->v_mount->mnt_stat.f_fstypename, "afs")))) {
+                       error = EXDEV;
+                       goto abortit;
+       }
+
     /*
      * if fvp == tvp, we're just removing one name of a pair of
      * directory entries for the same element.  convert call into rename.