summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c6
-rw-r--r--xlators/cluster/dht/src/dht-helper.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index 05592154e30..b1de9ff44aa 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -38,14 +38,14 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
conf = this->private;
prev = cookie;
- if (op_ret == -1) {
+ if (op_ret == -1 || !statvfs) {
gf_msg (this->name, GF_LOG_WARNING, op_errno,
DHT_MSG_GET_DISK_INFO_ERROR,
"failed to get disk info from %s", prev->name);
goto out;
}
- if (statvfs && statvfs->f_blocks) {
+ if (statvfs->f_blocks) {
percent = (statvfs->f_bavail * 100) / statvfs->f_blocks;
bytes = (statvfs->f_bavail * statvfs->f_frsize);
/*
@@ -60,7 +60,7 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
chunks = (statvfs->f_blocks + bpc - 1) / bpc;
}
- if (statvfs && statvfs->f_files) {
+ if (statvfs->f_files) {
percent_inodes = (statvfs->f_ffree * 100) / statvfs->f_files;
} else {
/*
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 5c3d37ad104..0c249f0e84c 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -1158,7 +1158,9 @@ dht_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name)
return 0;
err:
- loc_wipe (child);
+ if (child) {
+ loc_wipe (child);
+ }
return -1;
}