From 12df19d015e1c70e844193aa390576d32df10ca5 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 5 Mar 2011 11:25:20 +1100 Subject: [PATCH] Small fix for 'df' on subset filesystems We should never report more available space than free space. 'free' space might be limited by the blocks_allowed, while the 'available' space calculation is for the total filesystem. So if free is actually less than the calculated 'available', we must reduce the 'available'. Signed-off-by: NeilBrown --- super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/super.c b/super.c index f6f66c7..68f0c35 100644 --- a/super.c +++ b/super.c @@ -1414,6 +1414,8 @@ static int lafs_statfs(struct dentry *de, struct kstatfs *buf) buf->f_bfree = buf->f_blocks - (fsroot->md.fs.cblocks_used + fsroot->md.fs.pblocks_used + fsroot->md.fs.ablocks_used); + if (buf->f_bfree < buf->f_bavail) + buf->f_bavail = buf->f_bfree; dprintk("df: tot=%ld free=%ld avail=%ld(%ld-%ld-%ld) cb=%ld pb=%ld ab=%ld\n", (long)buf->f_blocks, (long)buf->f_bfree, (long)buf->f_bavail, (long)fs->free_blocks, (long)fs->clean_reserved, -- 2.39.5