summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-01-29 16:09:29 +0530
committerAnand Avati <avati@gluster.com>2012-01-29 23:29:45 -0800
commit21bad6eb3a3c48ad3edc37927aeabcd3de8b9d64 (patch)
tree68a4efbc054d294a79758820724f5e942d155f94 /xlators/storage
parente2303e774e1e37cd9becb672a67278502724b369 (diff)
storage/posix: janitor should unset gfid handles
Change-Id: I449b6a55122dfc27035569e6eb1d74ddcea68a69 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> BUG: 785522 Reviewed-on: http://review.gluster.com/2697 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c8
1 files changed, 8 insertions, 0 deletions
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;
}