Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2490044pxj; Mon, 10 May 2021 04:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9WRo4Sqmnbba8JJqwZqBzov1/fbIj46HgB4IF4cEuv6tCxFzy87+EElB7AKFcpl23XOvJ X-Received: by 2002:a92:1805:: with SMTP id 5mr20739759ily.82.1620645687529; Mon, 10 May 2021 04:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645687; cv=none; d=google.com; s=arc-20160816; b=MymJiVPmI3dZ2NWgIy13JVxUT5YPUibGgxpC6va0vmFSgaPU3BdwfzpBZ4Nl+xMIxg 4W2TidAICpMMZKdVgF41QuQNhoOTp9ULGBbZRaFnznqQM8ndenc7vH1eIsaZnInonacM HvURkM4HJrhtsJFO8IW+C5Rl2paQrLT5opuE74ilxNfV6F/s6C2QNngWbu8fF0Mv4QW1 Qdjgt2wGR4Zr62pvgyIA6u7TuzbKYHdVBH+XvnxTAQMZJMKndTAHETPo4o4aNzG7QSAo GWDfLzZLaRK5V66bqURQFzViUuCawsL44Q4Mlpkw1wkk6Olbup+T6spaPcJsHU4eBmoM sIAw== 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=eDE3Tc9nVGr/1xJoro4U1dbt99ksxcMowWIOt4ZDFgq2f3gLkPr8kSO+xSbWfRADzD ixMTxvI+9+BJCnvOhJP4Lzo48YkKTRDx+tmW7CQenhrnIzkxVmU4Mm6sesiAzaZ0gBCO d3XbHk2fnjhm2yhPdhGa4LfxUgX2lTT0YcrUg4Z+58iWtOnyhpPxxzySYUaoskFNOSS8 0XCNxvRqigLz7rkTS0md6SGHoclSu2hSCBsrYqYFo/+Ffx3oEuoNOTV3dBgjgtC/vpML YmB0rvteNEwdTo0cPcyQ293rgkyn5yPgMGPihwoBp1wGWpkICtETfwxKCA9CPpuMuZzH d4Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Whj+j/+3"; 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 r9si16135339ilt.62.2021.05.10.04.21.14; Mon, 10 May 2021 04:21:27 -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="Whj+j/+3"; 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 S237701AbhEJLQA (ORCPT + 99 others); Mon, 10 May 2021 07:16:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:41704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233749AbhEJKud (ORCPT ); Mon, 10 May 2021 06:50:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 793BE61A19; Mon, 10 May 2021 10:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643215; bh=C1dqAl8yM/FcmpKUv7/eSkotv/kH+Fip/4XB2HDQ1OA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Whj+j/+3pSFyZHlshcqLNG7Vz2mcAaEWSqO0MUuff/lNXlQNh39cQ3bewGZoTpj8h A3i7vHeGofRrESMr7qez8MacaTe9f9lOSW2HCbUsVkvzoZbE2r+G4FtvE35jPNu3qe FLKGjqJaLB4RXduWT45yUjYSixjtZlsubHLi9wa8= 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.10 224/299] fs: fix reporting supported extra file attributes for statx() Date: Mon, 10 May 2021 12:20:21 +0200 Message-Id: <20210510102012.337598131@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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);