From b41e30a55c8aeb6d7f42d74f9eb090232032057f Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 10 Nov 2011 11:58:12 -0600 Subject: [PATCH] namei: Remove extraneous rmdir 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 Reviewed-by: Derrick Brashear --- src/vol/namei_ops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 904b81c468..d1ecabf6ae 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -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); } }