From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dongsheng Yang Subject: [PATCH 22/25] ubifs: adapt quota space informatin in do_setattr Date: Tue, 21 Jul 2015 16:37:53 +0800 Message-ID: <1437467876-22106-23-git-send-email-yangds.fnst@cn.fujitsu.com> References: <1437467876-22106-1-git-send-email-yangds.fnst@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Dongsheng Yang To: , , Return-path: Received: from cn.fujitsu.com ([59.151.112.132]:46681 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754187AbbGUIn4 (ORCPT ); Tue, 21 Jul 2015 04:43:56 -0400 In-Reply-To: <1437467876-22106-1-git-send-email-yangds.fnst@cn.fujitsu.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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