* [PATCH v2] quota: fix a problem about transfer quota
@ 2019-03-26 14:00 yangerkun
2019-03-26 16:43 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: yangerkun @ 2019-03-26 14:00 UTC (permalink / raw)
To: jack; +Cc: yi.zhang, houtao1, miaoxie, yangerkun, linux-fsdevel
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
Fixes: 7b9ca4c61("quota: Reduce contention on dq_data_lock")
Signed-off-by: yangerkun <yangerkun@huawei.com>
---
fs/quota/dquot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06..dd1783e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] quota: fix a problem about transfer quota
2019-03-26 14:00 [PATCH v2] quota: fix a problem about transfer quota yangerkun
@ 2019-03-26 16:43 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-03-26 16:43 UTC (permalink / raw)
To: yangerkun; +Cc: jack, yi.zhang, houtao1, miaoxie, linux-fsdevel
On Tue 26-03-19 22:00:02, yangerkun wrote:
> 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
>
> Fixes: 7b9ca4c61("quota: Reduce contention on dq_data_lock")
> Signed-off-by: yangerkun <yangerkun@huawei.com>
Thanks! I've added the fix to my tree.
Honza
> ---
> fs/quota/dquot.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index fc20e06..dd1783e 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -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);
> --
> 2.7.4
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-26 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26 14:00 [PATCH v2] quota: fix a problem about transfer quota yangerkun
2019-03-26 16:43 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).