namei: Remove extraneous rmdir
authorAndrew Deason <adeason@sinenomine.net>
Thu, 10 Nov 2011 17:58:12 +0000 (11:58 -0600)
committerDerrick Brashear <shadow@dementix.org>
Fri, 11 Nov 2011 12:40:34 +0000 (04:40 -0800)
We just unlinked the file, so we know we won't be able to rmdir() the
same thing. Give a path one level higher to
namei_RemoveDataDirectories, so we start rmdir()ing at the parent dir.

Change-Id: Ifa54d1cc07ed2d277416d09eabc45aa1e1c3803a
Reviewed-on: http://gerrit.openafs.org/5833
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/vol/namei_ops.c

index 904b81c..d1ecabf 100644 (file)
@@ -1006,6 +1006,11 @@ namei_dec(IHandle_t * ih, Inode ino, int p1)
                /* Try to remove directory. If it fails, that's ok.
                 * Salvage will clean up.
                 */
+               char *slash = strrchr(name.n_path, OS_DIRSEPC);
+               if (slash) {
+                   /* avoid an rmdir() on the file we just unlinked */
+                   *slash = '\0';
+               }
                (void)namei_RemoveDataDirectories(&name);
            }
        }