quota: fix a problem about transfer quota
PATCH v2 1/1 quota: fix a problem about transfer quota
Run below script as root, dquot_add_space will return -EDQUOT since __dquot_transfer call dquot_add_space with flags=0, and dquot_add_space think it's a preallocation. Fix it by set flags as DQUOT_SPACE_WARN.
mkfs.ext4 -O quota,project /dev/vdb
mount -o prjquota /dev/vdb /mnt
setquota -P 23 1 1 0 0 /dev/vdb
dd if=/dev/zero of=/mnt/test-file bs=4K count=1
chattr -p 23 test-file
--- fs/quota/dquot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/quota/dquot.c +2 -2
@@ -1993,8 +1993,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) &warn_to[cnt]);if (ret) goto over_quota; - ret =dquot_add_space (transfer_to[cnt], cur_space, rsv_space,0 , - &warn_to[cnt]); + ret =dquot_add_space (transfer_to[cnt], cur_space, rsv_space, +DQUOT_SPACE_WARN , &warn_to[cnt]);if (ret) {spin_lock (&transfer_to[cnt]->dq_dqb_lock);dquot_decr_inodes (transfer_to[cnt], inode_usage);
Signature · 1 line
2.7.4
Jan Kara
reviewerQuoted 4 lines · yangerkun
Run below script as root,
dquot_add_spacewill return-EDQUOTsince__dquot_transfercalldquot_add_spacewith flags=0, anddquot_add_spacethink it's a preallocation. Fix it by set flags asDQUOT_SPACE_WARN.
Quoted 8 lines
mkfs.ext4 -O quota,project
/dev/vdb
mount -o prjquota/dev/vdb/mnt
setquota -P 23 1 1 0 0/dev/vdb
dd if=/dev/zero of=/mnt/test-file bs=4K count=1
chattr -p 23 test-fileFixes 7b9ca4c61("quota: Reduce contention on dq_data_lock")Signed-off-by yangerkun <[email protected]>
Thanks! I've added the fix to my tree.
Honza
Quoted 23 lines
--- fs/quota/dquot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/quota/dquot.c +2
-2@@ -1993,8 +1993,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) &warn_to[cnt]);if (ret) goto over_quota; - ret =dquot_add_space (transfer_to[cnt], cur_space, rsv_space,0 , - &warn_to[cnt]); + ret =dquot_add_space (transfer_to[cnt], cur_space, rsv_space, +DQUOT_SPACE_WARN , &warn_to[cnt]);if (ret) {spin_lock (&transfer_to[cnt]->dq_dqb_lock);dquot_decr_inodes (transfer_to[cnt], inode_usage);Signature · 1 line
2.7.4
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR