Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp575484ybn; Thu, 3 Oct 2019 09:04:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwe09pHYnMkXsOt1AfCvn45AEtoZ6SX/XZ2xGW/FYVDtluXKYoowadLsMLmjQJpU3hwWIso X-Received: by 2002:a50:d2d4:: with SMTP id q20mr10470644edg.172.1570118688440; Thu, 03 Oct 2019 09:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570118688; cv=none; d=google.com; s=arc-20160816; b=JQxoXTb5isMH6xkdFG/TAipLb7YngxX4Z2UpTfUc6V40QYWl9h9C5cDiGDpd7A/DHn tvVAUziG+Vr3Pkk7sSYt1kkZQhV6W0GyO8t2XRkZ5Y51ZBWORFMtd9gH/dFzJqIpH7vl ShC4fKOcCEQAOJ8F81FBlrIs5prUQg4bOqK1fKBiJ1d9TArXR4rWTfkbgnSsjUJXDr+d AjHuVf8admnWcRrwtUozT3RYYXcotl7LylNl7fpljwnY7GtDkbRI17x2wxdIV8yBacuZ 8cCvJzqdy7+yNimSukL2UnKgTtZZNg1qX23VLQK3TdEXoQCz9vAdBGywnve1wBOsQMjt 26TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9EmvLOYkNUubD3+U/d2s68WamHtAaDUOqGmLtjFnb+8=; b=HgPpGkVzfcQW8q0Ol7Nlc6W+NUpmaN+JAPi6QYY468j3ZO73p1l3vo3+xNIOFNvznv 3gAjBBJ2LAZoDcjaEJ5YkRJ+GrRUkjxI/Q9GGBCLy0FE39yrzM6Vh94lS8KtJJILLMd9 BReR4XSFIYoAK+dPbkr4xlcUF7w4/tmpBzTm8qvdCIY/1SR+El52fWhVUk2I8mB4Gpt4 OM9HG2b2wZ6Azq7VQX3atqwxuHz0kpgv+XhtagRYCB606av8uouDpAVUT/xy2Y4XrCC3 SKqgoPQz/kc8TvSXd+hNESITrkWFPX911WwCgIcdXzJSxuLbDrNm/3lglxtXf1oUPve3 miXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmTbd0zd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si1747934eds.179.2019.10.03.09.04.23; Thu, 03 Oct 2019 09:04:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmTbd0zd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731422AbfJCP7s (ORCPT + 99 others); Thu, 3 Oct 2019 11:59:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731389AbfJCP7o (ORCPT ); Thu, 3 Oct 2019 11:59:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3154E21D81; Thu, 3 Oct 2019 15:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118383; bh=kEUcyf9ce6ZSDzVBodKAh4owIQCPHcgVn4yCbQNmwCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmTbd0zdeQo/pi6HHIujZBYBYiAORavXNpyde+CPqlZpJdiWoj9Sa/nGqfcX0vHmL 5ZlDRmnTIgkqp2nKzBMwQGj6qrab0377UXjl5Y2SOCZ7XgrWL9ZSDybcgseJsoJ/QE FVIJ+X/SADfIrR53J3r/2QNJVMCiMYSKHyDc9Lp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jan Kara Subject: [PATCH 4.4 92/99] quota: fix wrong condition in is_quota_modification() Date: Thu, 3 Oct 2019 17:53:55 +0200 Message-Id: <20191003154340.152105218@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") CC: stable@vger.kernel.org Signed-off-by: Chao Yu Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- 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)); }