The vos zap -force command does not remove the directories associated
with the volume in question (AFS_NAMEI_ENV). When the vos zap -force
command is executed, the volume server goes through the /vicep*/AFSIDat
directories and removes the files associated with the volume id received
as an argument. Unfortunately, the volume server does not remove the
directories associated with this volume. As a result, empty directories
are left behind.
To fix this problem, remove the empty directories left behind when vos
zap -force is executed.
Change-Id: I56fd52918223f87e424121bac6a086d7b0a46284
Reviewed-on: https://gerrit.openafs.org/12879
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
}
#endif
+/**
+ * Remove empty directories associated with the volume received
+ * as an argument.
+ *
+ * @param[in] pname vice partition path
+ * @param[in] vid volume id
+ *
+ * @return 0 on success
+ */
+int
+namei_RemoveDirectories(char *pname, afs_int32 vid)
+{
+ IHandle_t dirIH;
+ namei_t name;
+
+ memset(&dirIH, 0, sizeof(dirIH));
+
+ dirIH.ih_vid = vid;
+
+#ifdef AFS_NT40_ENV
+ dirIH.ih_dev = nt_DriveToDev(pname);
+#else
+ dirIH.ih_dev = volutil_GetPartitionID(pname);
+#endif
+ if (dirIH.ih_dev == -1) {
+ return -1;
+ }
+
+ namei_HandleToVolDir(&name, &dirIH);
+
+ return namei_RemoveDataDirectories(&name);
+}
+
#endif /* AFS_NAMEI_ENV */
extern void namei_SetWorkQueue(struct afs_work_queue *wq);
# endif
+int namei_RemoveDirectories(char *pname, afs_int32 vid);
+
#endif /* AFS_NAMEI_ENV */
#endif /* _AFS_NAMEI_OPS_H_H_ */
allInodes = NULL;
+#ifdef AFS_NAMEI_ENV
+ if (namei_RemoveDirectories(aname, avolid)) {
+ Log("Nuke: Could not remove some empty directories associated with "
+ "volume %u\n", avolid);
+ }
+#endif
+
/* at this point, we should try to remove the volume header file itself.
* the volume header file is the file named VNNNNN.vol in the UFS file
* system, and is a normal file. As such, it is not stamped with the