Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp26662ybp; Thu, 3 Oct 2019 09:41:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1KlpqqL9Wzh/b7ncrEuIcuIRhi41qZ88yECyCVTvlESkAOOn4wChEpbwLZ2Oab7xNd4Aj X-Received: by 2002:aa7:dcd7:: with SMTP id w23mr10354244edu.170.1570120906968; Thu, 03 Oct 2019 09:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120906; cv=none; d=google.com; s=arc-20160816; b=WfGLUNHilNauRmhezqcKkCCcdo25r55D6BarNX6xCmmZUzyFmtUffH14XO62ZspKMP CFITBhIaKXgkMoOdIXUGHcJu43AW1EWZfs8JL8T17VFWAsVcIjUCsBXn3/XnjYiJJNlM QiOae8C/1K6JWwskbtrV48MoZRSNqVPQvZE5QGBwBZtPT9COY62CUyRP3NwF5+3WWY95 4ADp+OL69QBZwoVypsMwx72PloIMIQdyYx5zGb/MaHiP6FhweHU4BR+HDTV4Q2cXNMnv MCiRwrSkAluc1Y1iVN60FDNRsllr0PuwGQGp7EyvHUkDtd+1Y511ifHVZbXUy0Njd2m9 xz/w== 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=IxHl1FruoARWq7WJzTHvjKphgPePqIt+4z20bJ0llfQ=; b=brviko6T0mVXyj4DiO2G59vokijtMv1paCsEB7L4epB5G+GzZnKhVg5Qd3U4hYAFSo lAC2aTfHKEA3GwNn5PFVyhIW82VCxfd70GQEjZ3tSNqHAqkFqAg4wrRN9TO93sfluYxi /bJsSZsNZCR+rFcbm0NGKVytyZcp2DM7brHJ8nGnLxtnbUszevQAxEEYN8gFPpz6QE+6 QpYp45MPL0QpbLjL+cqMi6cTTTCuQTUq2luunWse9Y6JsgUgJgYR5qiRnIJYCJYsdeJx +2d+OaIqAq9CMnh9lfGdpX6CRulBLjjOYZlrfo21Mgl1qCykdXc1V00qbjIBVZMYNZZj k+ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eSJ3Cg5U; 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 d25si1685221edq.65.2019.10.03.09.41.22; Thu, 03 Oct 2019 09:41:46 -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=eSJ3Cg5U; 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 S2404625AbfJCQhl (ORCPT + 99 others); Thu, 3 Oct 2019 12:37:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:47050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392063AbfJCQhk (ORCPT ); Thu, 3 Oct 2019 12:37:40 -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 A787B21783; Thu, 3 Oct 2019 16:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120659; bh=TJDCL/OzCzUm1R6VioSOIvxqDHPnNF2nC0aYF3S27Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSJ3Cg5U9EoOjN5gCKk/ZMeRw/wcd8BpYrF6r3o6usqljBCrqKsZsDMOiNwg1QqMz 5iVvYIO0QvIRytdrmHUn/92iEfmrnrQ7FYZbvAf4mEOaCDU3f7zUIz7zQldO7LwdvL xmV20YCgXS+o7K3jkVYKONcGbdLwqNxwdNWwbbp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jan Kara Subject: [PATCH 5.2 304/313] quota: fix wrong condition in is_quota_modification() Date: Thu, 3 Oct 2019 17:54:42 +0200 Message-Id: <20191003154603.127383955@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@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 @@ -22,7 +22,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)); }