@@ -574,6 +574,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
int err, budgeted = 1;
struct ubifs_budget_req req = { .mod_dent = 1, .dirtied_ino = 2 };
unsigned int saved_nlink = inode->i_nlink;
+ loff_t quota_size = inode->i_size;
/*
* Budget request settings: deletion direntry, deletion inode (+1 for
@@ -607,8 +608,11 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 1, 0);
if (err)
goto out_cancel;
+
unlock_2_inodes(dir, inode);
+ dquot_free_space_nodirty(inode, quota_size);
+
if (budgeted)
ubifs_release_budget(c, &req);
else {
@@ -1130,6 +1130,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);
@@ -1209,6 +1210,9 @@ 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;
+ dquot_free_space_nodirty(inode, quota_size);
out_budg:
if (budgeted)
In truncation and unlink, 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/dir.c | 4 ++++ fs/ubifs/file.c | 4 ++++ 2 files changed, 8 insertions(+)