[PATCH 22/25] ubifs: adapt quota space informatin in do_setattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In do_setattr, there is a possibility to change the size of
a file. In this case, we have to notify the changed size to
quota subsystem.

Signed-off-by: Dongsheng Yang <yangds.fnst@xxxxxxxxxxxxxx>
---
 fs/ubifs/file.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index b907f197..aac10bd 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1249,6 +1249,13 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
 
 	if (attr->ia_valid & ATTR_SIZE) {
 		dbg_gen("size %lld -> %lld", inode->i_size, new_size);
+		if (new_size > inode->i_size) {
+			err = dquot_alloc_space_nodirty(inode, new_size - inode->i_size);
+			if (err)
+				return err;
+		} else {
+			dquot_free_space_nodirty(inode, inode->i_size - new_size);
+		}
 		truncate_setsize(inode, new_size);
 	}
 
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux