From fa66ba98c38df70892cdcaffdca430dbfa472831 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 28 May 2009 20:12:05 +0000 Subject: 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 --- xlators/cluster/dht/src/dht-diskusage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators') 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); { -- cgit