Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2346466ybz; Thu, 23 Apr 2020 16:27:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKchHjE0RxO6Tn0qhiYkMwKsBbOwaATvi/b+maz0ETZ09RFAq+kXoF/izQmKz37DuiTaxXq X-Received: by 2002:a17:906:16ca:: with SMTP id t10mr4907616ejd.122.1587684471595; Thu, 23 Apr 2020 16:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587684471; cv=none; d=google.com; s=arc-20160816; b=jO1g9oih2zU/UOxSV3FXdZwm1Gb+fA4xbATUPdzGgA1hNvqUOASgiX24Zn6C6nZMcO NBrFfPQG25awuve91Io32NEkEh4ORXwsM5QJw/Z70/8JqhfOC+NLZq+AYu1jR4bB5N/p Qa4gisISiG5UWwGNr6DqBCX8Ko+Jj+UxBPy/2QhI7FwcmEqRrX1Q7ABeZVAQaq1UVhO8 qQLaYEuoe/9x1zX825Uo2K52iYgMd6V+2d5q4FFTloYnwhsxh1AoZ1GU13U007cnBBeI 3dpZ8B8BZhbHJAqk4YzA++pH1JJNLwIC9QZAjVRmGJ3thI/YJPRgSDS4I26vbTfmsB2N JWTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=VH3Wok854F1VOquzosSc6RQoPiaZ5EEX3Tdu9bVchuc=; b=GobbnmKXMetSbE1xvD/vM1PoWS/KpV5t3Mt0Shhovkj+Jj1JvALE/EqRW/0B0APe5v NWIN/LTvVP9/PZNtApd8Eiptgzk0ESsJCUmoN1NmbNEGF2G3ZaO5nJvFZr45lEiCRTzN en9r6XkLpNs4uA6kmf6jqzNAY5s17BlRSLqdWsfOY6IqrA3AM6LByfEoFjLJpCXFLGFY uLv3GXHp+wFxKqAmao2xWuqLyWB3gnsHTGUEtnrsT4p1Swd7jUXz7j4inaeKfFVYB5tr asGuLtAFPGSyhYVBhadE1zrrDFB/UjiK03q3cbdWAzN1MPUm8XWsiapEJGlFawIRTU7P KRBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si1399061edq.433.2020.04.23.16.27.28; Thu, 23 Apr 2020 16:27:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730052AbgDWXZ1 (ORCPT + 99 others); Thu, 23 Apr 2020 19:25:27 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:48192 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728083AbgDWXG2 (ORCPT ); Thu, 23 Apr 2020 19:06:28 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvI-0004ZW-7j; Fri, 24 Apr 2020 00:06:24 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvH-00E6f9-OA; Fri, 24 Apr 2020 00:06:23 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Chao Yu" , "Jan Kara" Date: Fri, 24 Apr 2020 00:04:00 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 013/245] quota: fix wrong condition in is_quota_modification() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Chao Yu commit 6565c182094f69e4ffdece337d395eb7ec760efc upstream. Quoted from commit 3da40c7b0898 ("ext4: only call ext4_truncate when size <= isize") " At LSF we decided that if we truncate up from isize we shouldn't trim fallocated blocks that were fallocated with KEEP_SIZE and are past the new i_size. This patch fixes ext4 to do this. " And generic/092 of fstest have covered this case for long time, however is_quota_modification() didn't adjust based on that rule, so that in below condition, we will lose to quota block change: - fallocate blocks beyond EOF - remount - truncate(file_path, file_size) Fix it. Link: https://lore.kernel.org/r/20190911093650.35329-1-yuchao0@huawei.com Fixes: 3da40c7b0898 ("ext4: only call ext4_truncate when size <= isize") Signed-off-by: Chao Yu Signed-off-by: Jan Kara Signed-off-by: Ben Hutchings --- include/linux/quotaops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -21,7 +21,7 @@ static inline struct quota_info *sb_dqop /* i_mutex must being held */ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) { - return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) || + return (ia->ia_valid & ATTR_SIZE) || (ia->ia_valid & ATTR_UID && !uid_eq(ia->ia_uid, inode->i_uid)) || (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid)); }