Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp73748ybp; Thu, 3 Oct 2019 10:20:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTEZO1iclHTsW2zKbAoeFhsUhBvbOsbGXZawHYANx76kCKVt3/E15JqmLZxMLLuDnuuZNl X-Received: by 2002:a17:906:1347:: with SMTP id x7mr1084410ejb.322.1570123255516; Thu, 03 Oct 2019 10:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570123255; cv=none; d=google.com; s=arc-20160816; b=gEwgjLP8iFuQE56i+yxBg+DCR+9dbCHFjEf3iyZixB2SN6Iuo1uxz2TXN7SLEX78aC DlvQlfAC+suhTS4Jkq3spEg4M0OREiDItBIsMaRiNlpepDWRUh5hNkfJR5vt0uZEvbLi QOhHJyXJEj7j3BZ4pd2F9f8CkvYOzLjlx3M4nJitRq7y+gvjM59CdpCHCzjVSWdzFGOa Ce9ZNoaZhTd5i9iC6aUbDbDLE18cCqvVXoQGRafKhK/Fc5lBFizO0y+LGe5gS8RJjpPA 9NVSSGrNltEvWydJDtNoBBEDPRc6rBMe+0G22oVmvaPAGIW66/QNpdqzj+HfQnwsJcy4 N0Qw== 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=ow9FnPrX4q9Pd9icdifG2X0gdbpDlA8YFTh8mTFwrjVu50RnP0uxqlfua7kgJLmRpy 7ADw3YC9IXmAT1YADkAZa1dgnBG1KeAvEYfTC46Zsm+PWdLahsC5ARtwjWXFJivy37GN +kR/fKG0K+g5WB8vpRRk3RDjlBeTFDieeI8qh1VWye6upvcbXb4dwIQISgHS8X7OZj6k nqL1wlPVGg/LJ0aSvdfF7b1T4kut4pshc84kXRGNgwMe6k4/DSYA5yNdzDd/LqwRq25v Oqp7jJ9tPqOfeJkeO4gWFFpGkTMUJlm9nwY71D3xMvMRJz6MxyExJYBgPW2iFUhWYt0T Xk7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kk0keye6; 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 j21si1770264edr.376.2019.10.03.10.20.30; Thu, 03 Oct 2019 10:20:55 -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=Kk0keye6; 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 S2391853AbfJCRQz (ORCPT + 99 others); Thu, 3 Oct 2019 13:16:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390588AbfJCQXd (ORCPT ); Thu, 3 Oct 2019 12:23:33 -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 4BB0C2054F; Thu, 3 Oct 2019 16:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119812; bh=TJDCL/OzCzUm1R6VioSOIvxqDHPnNF2nC0aYF3S27Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kk0keye6z0j0yOCYSAF4LPHasJMrr7kpKAUVkgc+a4YeQ2+8QI6BFxfaVe54glYcw z6j5CZfVE3XGHC6AGU6VIMRPy8crp4kN5ipz8v7+ZCaa5iOse6cBUoPEr1rYir6vwT xF5zcQkIqmKZHb0U3h0VpH21yxyAPKfEuGUZkSH8= 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.19 203/211] quota: fix wrong condition in is_quota_modification() Date: Thu, 3 Oct 2019 17:54:29 +0200 Message-Id: <20191003154530.006484306@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@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)); }