summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot/src/bitd
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2018-04-20 14:54:33 -0400
committerAmar Tumballi <amarts@redhat.com>2018-05-04 11:13:57 +0000
commitb42a048d3a76c7f377399f18d30f0a8a930f9d05 (patch)
treeb400225db569fdd1b3251105024bec73690da175 /xlators/features/bit-rot/src/bitd
parentbef654f48c14bfd7ce20702edff41052f6f54bdc (diff)
features/bitrot: print the path of the corrupted objects
Currently "gluster volume bitrot <volume name> scrub status" gives the list of the corrupted objects (files as of now). But only the gfids of those corrupted objects are seen and one has to do getfattr, find etc operations to get the actual path of those objects for removal etc. This change makes an attempt to print the path of those files as much as possible. * Try to get the path using the on disk gfid2path xattr. * If the above operation fails, then go for in memory path (provided that the object has its dentry properly created and linked in the inode table of the brick where the corrupted object is present) So the gfid to path resolution is a soft resolution, i.e. based on the inode and dentry cache in the brick's memory. If the path cannot be obtained via inode table also, then only gfid is printed. Change-Id: Ie9a30307f43a49a2a9225821803c7d40d231de68 fixes: bz#1570962 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index 7012f2f0a4a..ee996525f76 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -1625,11 +1625,12 @@ br_read_bad_object_dir (xlator_t *this, br_child_t *child, fd_t *fd,
off_t offset = 0;
int32_t count = 0;
char key[PATH_MAX] = {0, };
+ dict_t *out_dict = NULL;
INIT_LIST_HEAD (&entries.list);
while ((ret = syncop_readdir (child->xl, fd, 131072, offset, &entries,
- NULL, NULL))) {
+ NULL, &out_dict))) {
if (ret < 0)
goto out;
@@ -1647,6 +1648,12 @@ br_read_bad_object_dir (xlator_t *this, br_child_t *child, fd_t *fd,
entry->d_name);
if (!ret)
count++;
+
+ if (out_dict) {
+ dict_copy (out_dict, dict);
+ dict_unref (out_dict);
+ out_dict = NULL;
+ }
}
gf_dirent_free (&entries);
@@ -1742,6 +1749,7 @@ br_collect_bad_objects_of_child (xlator_t *this, br_child_t *child,
int32_t tmp_count = 0;
char *entry = NULL;
char tmp[PATH_MAX] = {0, };
+ char *path = NULL;
ret = dict_get_int32 (child_dict, "count", &count);
if (ret)
@@ -1755,14 +1763,16 @@ br_collect_bad_objects_of_child (xlator_t *this, br_child_t *child,
if (ret)
continue;
- snprintf (tmp, PATH_MAX, "%s ==> BRICK: %s",
- entry, child->brick_path);
+ ret = dict_get_str (child_dict, entry, &path);
+ snprintf (tmp, PATH_MAX, "%s ==> BRICK: %s\n path: %s",
+ entry, child->brick_path, path);
snprintf (main_key, PATH_MAX, "quarantine-%d",
tmp_count);
ret = dict_set_dynstr_with_alloc (dict, main_key, tmp);
- if (!ret)
- tmp_count++;
+ if (!ret)
+ tmp_count++;
+ path = NULL;
}
ret = tmp_count;