@@ -1136,6 +1136,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
int err;
struct ubifs_budget_req req;
loff_t old_size = inode->i_size, new_size = attr->ia_size;
+ loff_t quota_size = (old_size - new_size);
int offset = new_size & (UBIFS_BLOCK_SIZE - 1), budgeted = 1;
struct ubifs_inode *ui = ubifs_inode(inode);
@@ -1215,6 +1216,10 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
do_attr_changes(inode, attr);
err = ubifs_jnl_truncate(c, inode, old_size, new_size);
mutex_unlock(&ui->ui_mutex);
+ if (quota_size < 0)
+ quota_size = 0;
+ if (S_ISREG(inode->i_mode))
+ dquot_free_space_nodirty(inode, quota_size);
out_budg:
if (budgeted)
In truncation, we have to tell quota subsystem to update the quota information of the space changing. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> --- fs/ubifs/file.c | 5 +++++ 1 file changed, 5 insertions(+)