[PATCH v3 31/39] ubifs: free quota space in do_truncation
Dongsheng Yang
yangds.fnst at cn.fujitsu.com
Tue Sep 15 02:02:26 PDT 2015
In truncation, we have to tell quota subsystem
to update the quota information of the space changing.
Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
---
fs/ubifs/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 64ca91c..59b2098 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -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)
--
1.8.4.2
More information about the linux-mtd
mailing list