From bf64ebb2faaba0666068c502353fb0c49c23c756 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 28 Nov 2012 14:03:55 -0500 Subject: [PATCH] nfsdcltrack: skip "." and ".." when trying to clean out legacy recdir readdir picks up these two entries as "normal" dentries, but rmdir'ing them won't work (and we wouldn't want to remove them anyway). Signed-off-by: Jeff Layton Signed-off-by: Steve Dickson --- utils/nfsdcltrack/nfsdcltrack.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c index 9801b9c..4334340 100644 --- a/utils/nfsdcltrack/nfsdcltrack.c +++ b/utils/nfsdcltrack/nfsdcltrack.c @@ -379,6 +379,17 @@ cltrack_legacy_gracedone(void) while ((entry = readdir(v4recovery))) { int len; + /* skip "." and ".." */ + if (entry->d_name[0] == '.') { + switch (entry->d_name[1]) { + case '\0': + continue; + case '.': + if (entry->d_name[2] == '\0') + continue; + } + } + /* borrow the clientid blob for this */ len = snprintf((char *)blob, sizeof(blob), "%s/%s", dirname, entry->d_name); -- 2.39.5