提交 6360e21f 编写于 作者: D Dmitry Monakhov 提交者: Jan Kara

ext3: Allow quota file use root reservation

Quota file is fs's metadata, so it is reasonable  to permit use
root resevation if necessary. This patch fix 265'th xfstest failure
Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 23cc94ea
...@@ -1440,14 +1440,14 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, ...@@ -1440,14 +1440,14 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
* *
* Check if filesystem has at least 1 free block available for allocation. * Check if filesystem has at least 1 free block available for allocation.
*/ */
static int ext3_has_free_blocks(struct ext3_sb_info *sbi) static int ext3_has_free_blocks(struct ext3_sb_info *sbi, int use_reservation)
{ {
ext3_fsblk_t free_blocks, root_blocks; ext3_fsblk_t free_blocks, root_blocks;
free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
sbi->s_resuid != current_fsuid() && !use_reservation && sbi->s_resuid != current_fsuid() &&
(sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
return 0; return 0;
} }
...@@ -1468,7 +1468,7 @@ static int ext3_has_free_blocks(struct ext3_sb_info *sbi) ...@@ -1468,7 +1468,7 @@ static int ext3_has_free_blocks(struct ext3_sb_info *sbi)
*/ */
int ext3_should_retry_alloc(struct super_block *sb, int *retries) int ext3_should_retry_alloc(struct super_block *sb, int *retries)
{ {
if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3) if (!ext3_has_free_blocks(EXT3_SB(sb), 0) || (*retries)++ > 3)
return 0; return 0;
jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
...@@ -1546,7 +1546,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, ...@@ -1546,7 +1546,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0)) if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0))
my_rsv = &block_i->rsv_window_node; my_rsv = &block_i->rsv_window_node;
if (!ext3_has_free_blocks(sbi)) { if (!ext3_has_free_blocks(sbi, IS_NOQUOTA(inode))) {
*errp = -ENOSPC; *errp = -ENOSPC;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册