ext4: mballoc avoid use root reserved blocks for non root allocation
mballoc allocation missed check for blocks reserved for root users. Add ext4_has_free_blocks() check before allocation. Also modified ext4_has_free_blocks() to support multiple block allocation request. Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
committed by
Theodore Ts'o
parent
d755fb3842
commit
0703143107
@@ -4045,6 +4045,12 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
|
||||
&(ar->len), errp);
|
||||
return block;
|
||||
}
|
||||
ar->len = ext4_has_free_blocks(sbi, ar->len);
|
||||
|
||||
if (ar->len == 0) {
|
||||
*errp = -ENOSPC;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (ar->len && DQUOT_ALLOC_BLOCK(ar->inode, ar->len)) {
|
||||
ar->flags |= EXT4_MB_HINT_NOPREALLOC;
|
||||
@@ -4073,7 +4079,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
|
||||
|
||||
ac->ac_op = EXT4_MB_HISTORY_PREALLOC;
|
||||
if (!ext4_mb_use_preallocated(ac)) {
|
||||
|
||||
ac->ac_op = EXT4_MB_HISTORY_ALLOC;
|
||||
ext4_mb_normalize_request(ac, ar);
|
||||
repeat:
|
||||
|
Reference in New Issue
Block a user