diff options
-rw-r--r-- | fs/hugetlbfs/inode.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 64983ab55586..8c1cef3bb677 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -512,10 +512,14 @@ static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf) | |||
512 | buf->f_bsize = HPAGE_SIZE; | 512 | buf->f_bsize = HPAGE_SIZE; |
513 | if (sbinfo) { | 513 | if (sbinfo) { |
514 | spin_lock(&sbinfo->stat_lock); | 514 | spin_lock(&sbinfo->stat_lock); |
515 | buf->f_blocks = sbinfo->max_blocks; | 515 | /* If no limits set, just report 0 for max/free/used |
516 | buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; | 516 | * blocks, like simple_statfs() */ |
517 | buf->f_files = sbinfo->max_inodes; | 517 | if (sbinfo->max_blocks >= 0) { |
518 | buf->f_ffree = sbinfo->free_inodes; | 518 | buf->f_blocks = sbinfo->max_blocks; |
519 | buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; | ||
520 | buf->f_files = sbinfo->max_inodes; | ||
521 | buf->f_ffree = sbinfo->free_inodes; | ||
522 | } | ||
519 | spin_unlock(&sbinfo->stat_lock); | 523 | spin_unlock(&sbinfo->stat_lock); |
520 | } | 524 | } |
521 | buf->f_namelen = NAME_MAX; | 525 | buf->f_namelen = NAME_MAX; |