From 21bad6eb3a3c48ad3edc37927aeabcd3de8b9d64 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sun, 29 Jan 2012 16:09:29 +0530 Subject: storage/posix: janitor should unset gfid handles Change-Id: I449b6a55122dfc27035569e6eb1d74ddcea68a69 Signed-off-by: Pranith Kumar K BUG: 785522 Reviewed-on: http://review.gluster.com/2697 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/storage/posix/src/posix-helpers.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 346e6a7a640..20a9528b09f 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -718,6 +718,11 @@ static int janitor_walker (const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { + struct iatt stbuf = {0, }; + xlator_t *this = NULL; + + this = THIS; + posix_pstat (this, NULL, fpath, &stbuf); switch (sb->st_mode & S_IFMT) { case S_IFREG: case S_IFBLK: @@ -728,6 +733,8 @@ janitor_walker (const char *fpath, const struct stat *sb, gf_log (THIS->name, GF_LOG_TRACE, "unlinking %s", fpath); unlink (fpath); + if (stbuf.ia_nlink == 1) + posix_handle_unset (this, stbuf.ia_gfid, NULL); break; case S_IFDIR: @@ -736,6 +743,7 @@ janitor_walker (const char *fpath, const struct stat *sb, "removing directory %s", fpath); rmdir (fpath); + posix_handle_unset (this, stbuf.ia_gfid, NULL); } break; } -- cgit