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:00:39 -0700
commitfa66ba98c38df70892cdcaffdca430dbfa472831 (patch)
treeb1d26fa7efcca78817e7c39dffc6534556c08da9
parent9c0ee1e20c857a580181d52cfbdce44d3c61b404 (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 830cf2d0e..561e5d518 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);
{