disconnected-flush-before-shadowing-20090119
[openafs.git] / src / afs / afs_disconnected.c
index 4d5f192..e52c3f6 100644 (file)
@@ -271,10 +271,12 @@ int afs_GetVnodeName(struct vcache *avc,
 
     if (tdc) {
        tnf.fid = &avc->fid;
-       tnf.name_len = 0;
+       tnf.name_len = -1;
        tnf.name = aname;
        afs_dir_EnumerateDir(tdc, &get_vnode_name_hook, &tnf);
        afs_PutDCache(tdc);
+       if (tnf.name_len == -1)
+           code = ENOENT;
     } else {
         code = ENOENT;
     }
@@ -322,8 +324,10 @@ int chk_del_children_hook(void *hdata,
     /* Count unfinished dirty children. VDisconShadowed can still be set,
      * because we need it to remove the shadow dir.
      */
-    if (tvc && tvc->ddirty_flags) {
-       v->count++;
+    if (tvc) {
+       if (tvc->ddirty_flags)
+           v->count++;
+
        afs_PutVCache(tvc);
     }
 
@@ -1283,11 +1287,10 @@ skip_file:
                    /* We can discard the shadow dir now. */
                    afs_DeleteShadowDir(tmp);
 
-               if (tmp->ddirty_flags & VDisconRemove)
-                   /* Drop the refcount on the deleted vnodes,
-                    * because we don't need them anymore.
-                    */
-                   afs_PutVCache(tmp);
+               /* Drop the refcount on this vnode because it's not in the
+                * list anymore.
+                */
+                afs_PutVCache(tmp);
 
                /* Only if sync was successfull,
                 * clear flags and dirty references.