summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-05-28 20:12:05 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-02 03:16:08 -0700
commita7e5888508a2f08e6891eb5a472b7edf737e15da (patch)
tree993b6b351c9fc00304a43cba68362df62481d4cb
parentf5d0e815b43b3957396dd6c4a768ba87db2ae9c5 (diff)
bug fix in dht-diskusage when statvfs->f_blocks is 0
This can happen when 'option export-statfs-size off' is given in posix volume. Caused divide by 0 error. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index 830cf2d0e70..561e5d518cb 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -50,8 +50,9 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1)
goto out;
-
- percent = (statvfs->f_bfree * 100) / statvfs->f_blocks;
+
+ if (statvfs && statvfs->f_blocks)
+ percent = (statvfs->f_bfree * 100) / statvfs->f_blocks;
LOCK (&conf->subvolume_lock);
{