ext4: make sure ext4_has_free_blocks returns 0 for ENOSPC

Fix ext4_has_free_blocks() to return 0 when we don't have enough space.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

authored by Aneesh Kumar K.V and committed by Theodore Ts'o 16eb7295 525f4ed8

+3
+3
fs/ext4/balloc.c
··· 1626 1626 free_blocks = 1627 1627 percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); 1628 1628 #endif 1629 + if (free_blocks <= root_blocks) 1630 + /* we don't have free space */ 1631 + return 0; 1629 1632 if (free_blocks - root_blocks < nblocks) 1630 1633 return free_blocks - root_blocks; 1631 1634 return nblocks;