Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2522553pxj; Mon, 10 May 2021 05:08:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8+e5CdBDrkuDj5/JmfdDUUfbkekHOC858Fly/tMFesQQudqVcT3JtAD7hVgZ8WXmg6qxc X-Received: by 2002:a7b:c1c5:: with SMTP id a5mr36679529wmj.63.1620648498961; Mon, 10 May 2021 05:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620648498; cv=none; d=google.com; s=arc-20160816; b=w+TT1xKumKui+6fV/gJbVT3gXo9vhTUFPCPrRzNdwIr6k2lmsO943EDxbYqTSQxsp5 XcyfNp/Z2yXEbI6JK8XqOE72KC+TqnilZnMtLPlS7gpEdw0/nRYV40lKMkdf35trs6y8 c4vUfe8DuWwpp80Dapj5AaMWe3VtlIenB70LjSb9DlGrDR+SR0lCa4T4f539xDNSw+XR xXPmbol13MRepQGKwce6VodL3UQci2mAFVuEYRs0MZyzsPxs0bmUBFpv9OIpMAv44Wob Ejd5Ba5eqGYZDppa7cdiUN9noO7MCSO0uK2JSW0FhLCm+N23GgiYjL99GCcLeg5RmCgU Z4cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QbwXNGPOedlNCcWJ13wxWv+TtWcfwF73K8u4p55rEXg=; b=A4rHTOLcSidq7KhH1B47H4216NkhaLHZlNW55oFylXBdNtPC0Xkw6taefZbEvNuK3N 0Z2/O4caJhSjav3biir/XpbowV5K3d7eYlruPf64AufMfujN1MJi5AXfcn6N73F9jOcj BQzFsesG6kH4qEObIbkAqh/uByP4TpNDcIzO3yLREs3LStQ2tjl6bFroY66Hc9cATMWn PW1KXApmz11Hnc0N64/XcSKV9k/rL4eDQFQN3zf2d0TneHaz7DkVZ4nDsZ6E7IxC9zHJ SEo2Tb2+npxC2tHTxaJSrcomm8xy2CEfy3+NJ0selKWDQY4uEpQW/PP0tnydy+2pocAh HvHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2ZrFvDkr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si14274913edc.594.2021.05.10.05.07.52; Mon, 10 May 2021 05:08:18 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2ZrFvDkr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241882AbhEJLzk (ORCPT + 99 others); Mon, 10 May 2021 07:55:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234684AbhEJLFO (ORCPT ); Mon, 10 May 2021 07:05:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21D83610A7; Mon, 10 May 2021 10:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644107; bh=C1dqAl8yM/FcmpKUv7/eSkotv/kH+Fip/4XB2HDQ1OA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ZrFvDkrrTYQGEao0EzcC7CxC0kf0W2oLVRC0fy/czA7it6/2q3Ckw8aM6YFtVDMG /hOC0xmACZlXI5BycIAEuznyYsQiE8eQEFgsRStH6fYXqXPnq5dC43dczw2y3xqChh v8GcttqTsBIDqmI9P6coaNirGrNdQ2SyYkQGWb7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Theodore Tso Subject: [PATCH 5.11 255/342] fs: fix reporting supported extra file attributes for statx() Date: Mon, 10 May 2021 12:20:45 +0200 Message-Id: <20210510102018.528621214@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102010.096403571@linuxfoundation.org> References: <20210510102010.096403571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Theodore Ts'o commit 5afa7e8b70d65819245fece61a65fd753b4aae33 upstream. statx(2) notes that any attribute that is not indicated as supported by stx_attributes_mask has no usable value. Commits 801e523796004 ("fs: move generic stat response attr handling to vfs_getattr_nosec") and 712b2698e4c02 ("fs/stat: Define DAX statx attribute") sets STATX_ATTR_AUTOMOUNT and STATX_ATTR_DAX, respectively, without setting stx_attributes_mask, which can cause xfstests generic/532 to fail. Fix this in the same way as commit 1b9598c8fb99 ("xfs: fix reporting supported extra file attributes for statx()") Fixes: 801e523796004 ("fs: move generic stat response attr handling to vfs_getattr_nosec") Fixes: 712b2698e4c02 ("fs/stat: Define DAX statx attribute") Cc: stable@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/stat.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/stat.c +++ b/fs/stat.c @@ -77,12 +77,20 @@ int vfs_getattr_nosec(const struct path /* SB_NOATIME means filesystem supplies dummy atime value */ if (inode->i_sb->s_flags & SB_NOATIME) stat->result_mask &= ~STATX_ATIME; + + /* + * Note: If you add another clause to set an attribute flag, please + * update attributes_mask below. + */ if (IS_AUTOMOUNT(inode)) stat->attributes |= STATX_ATTR_AUTOMOUNT; if (IS_DAX(inode)) stat->attributes |= STATX_ATTR_DAX; + stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | + STATX_ATTR_DAX); + if (inode->i_op->getattr) return inode->i_op->getattr(path, stat, request_mask, query_flags);