summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-08-15 11:13:46 +0200
committerRaghavendra Bhat <raghavendra@redhat.com>2015-08-18 05:55:17 -0700
commitaefd42fdb74a9b276d07a51a84194805169e632e (patch)
treeb684a289189f5db3bde095d951d83bca2acd7de7
parentdf3f1d9926bf3e7a481391182aa967f0154634a3 (diff)
glusterd: really get the inode size for a brick
backport of http://review.gluster.org/#/c/8492/ The device to get the inode size from does not get passed to the tool (tune2fs, xfs_info or the like) that is called. This is probably just an oversight. While correcting this, cleanup some bits of the function too. Change-Id: Ida45852cba061631fb304bc7dd5286df1a808010 BUG: 1254421 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/8492 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/11941 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index b8934c45ab6..6275ae9a761 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7353,30 +7353,35 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count)
for (fs = glusterd_fs ; fs->fs_type_name; fs++) {
if (strcmp (fs_name, fs->fs_type_name) == 0) {
- snprintf (fs_tool_name, sizeof fs_tool_name,
+ snprintf (fs_tool_name, sizeof (fs_tool_name),
"/usr/sbin/%s", fs->fs_tool_name);
if (access (fs_tool_name, R_OK|X_OK) == 0)
runner_add_arg (&runner, fs_tool_name);
else {
- snprintf (fs_tool_name, sizeof fs_tool_name,
+ snprintf (fs_tool_name, sizeof (fs_tool_name),
"/sbin/%s", fs->fs_tool_name);
if (access (fs_tool_name, R_OK|X_OK) == 0)
runner_add_arg (&runner, fs_tool_name);
}
- if (runner.argv[0]) {
- if (fs->fs_tool_arg)
- runner_add_arg (&runner, fs->fs_tool_arg);
- }
break;
}
}
+ if (runner.argv[0]) {
+ if (fs->fs_tool_arg)
+ runner_add_arg (&runner, fs->fs_tool_arg);
+ runner_add_arg (&runner, device);
+ } else {
+ gf_log (THIS->name, GF_LOG_ERROR, "could not find %s to get"
+ "inode size for %s (%s): %s package missing?",
+ fs->fs_tool_name, device, fs_name, fs->fs_tool_pkg);
+ goto out;
+ }
+
ret = runner_start (&runner);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "could not get inode "
- "size for %s : %s package missing", fs_name,
- ((strcmp (fs_name, "xfs")) ?
- "e2fsprogs" : "xfsprogs"));
+ gf_log (THIS->name, GF_LOG_ERROR, "failed to execute "
+ "\"%s\": %s", fs->fs_tool_name, strerror (errno));
/*
* Runner_start might return an error after the child has
* been forked, e.g. if the program isn't there. In that
@@ -7384,7 +7389,7 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count)
* child and free resources. Fortunately, that seems to
* be harmless for other kinds of failures.
*/
- (void) runner_end(&runner);
+ (void) runner_end (&runner);
goto out;
}
@@ -7431,7 +7436,7 @@ cached:
ret = dict_set_dynstr_with_alloc (dict, key, cur_word);
- out:
+out:
if (ret)
gf_log (THIS->name, GF_LOG_ERROR, "failed to get inode size");
return ret;