Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4778558imu; Tue, 8 Jan 2019 06:13:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN5UgkaI9tQS7kBWqqHQwTVucVutJCiENZgCARpOs1Rbq4WJTEwFL+jjLluccCpIN33P2Q/S X-Received: by 2002:a62:3241:: with SMTP id y62mr1903594pfy.178.1546956839597; Tue, 08 Jan 2019 06:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546956839; cv=none; d=google.com; s=arc-20160816; b=ojM9CSe2wR+SYGJfrUMZyOoyFUmjfIwH7iaAZD9rCSNCqVtrsyhf3cSpIO1fRSOD36 ZuM8bY2SXcJZaQD2kddzbQgLEwZg0q4zvlmZ6XCToMiKJeP2Kl2CLOQD67WKZGsuFjxi GSWzyf2DnqBqBW6RdoNM2UgacrtQiUR4V/Nar+GT8uQGV2ceFxQf8H3/yOz9dZaPni7L uQYrV9233vAX0fHC54Wdas2IRvpsIzz8DN5Hj+8MPVR9XHBSHJhZb7hXluyJcYBTyzWp HbnvaWZm2VcPfvxEITLuC/WepVrDY4qw4zsLdY6X8ffP7S8aeBwbVeXd9uN6yEbkzFUs yK4w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=CYm5cm/nx4nCvld8lffoWj+CQMTSPhaA65EmNFvntPI=; b=g6jQKNPDXy85z11HEwD2/7OF1dJROVYFAaFLcbvsYwhsMglosDSZTW/ciQVTqS4yzd /+AFABpyQ3i2WWQuM6SWboDS7Aw/sL3jXYkXMP+Dg92e/7aENKBTdOJUIEnZHEE6c13A vUdUr6wQDkWupmXl+NK7+vb0581dF1gOi5rimZayNjvMUz32HLfHAZ+Pu2Hs1SoOK7zt aorNLfKlTNlHXsnK3obfT/dSA20vN2V1fI213yMPsV/Sy16WD8SbwEYWRGmlHnMD4LvI Mj3SWqPUfH6MZXUAWX+gDRJGlqJ7T6+rkFoOaQcr3I4amJdFE2dNoulSotP/kL5CA37E GqSg== ARC-Authentication-Results: i=1; mx.google.com; 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 a90si64907479plc.314.2019.01.08.06.13.44; Tue, 08 Jan 2019 06:13:59 -0800 (PST) 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; 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 S1729034AbfAHOLt (ORCPT + 99 others); Tue, 8 Jan 2019 09:11:49 -0500 Received: from sandeen.net ([63.231.237.45]:45086 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728522AbfAHOLs (ORCPT ); Tue, 8 Jan 2019 09:11:48 -0500 Received: from Liberator-6.local (erlite [10.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id 8453FB7C; Tue, 8 Jan 2019 08:11:02 -0600 (CST) Subject: Re: [PATCH] xfs: correct statx's result_mask value To: "Su Yanjun " , "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, suyanjun218@gmail.com References: <1546854790-5233-1-git-send-email-suyj.fnst@cn.fujitsu.com> <20190107175229.GJ12689@magnolia> <2b27e2ec-368b-d24c-8443-e265f87e417c@sandeen.net> <67e03af1-6e11-4236-76e6-6127b6cfb9b9@cn.fujitsu.com> <20190108050739.GQ12689@magnolia> <5c103aa0-8711-ceb3-38f8-dffe983526ff@cn.fujitsu.com> From: Eric Sandeen Openpgp: preference=signencrypt Autocrypt: addr=sandeen@sandeen.net; prefer-encrypt=mutual; keydata= xsFNBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaSBLHUq2ju2gJJLfBoL7V3807PQcI18YzkF+ WL05ODFQ2cemDhx5uLghHEeOxuGj+1AI+kh/FCzMedHc6k87Yu2ZuaWF+Gh1W2ix6hikRJmQ vj5BEeAx7xKkyBhzdbNIbbjV/iGi9b26B/dNcyd5w2My2gxMtxaiP7q5b6GM2rsQklHP8FtW ZiYO7jsg/qIppR1C6Zr5jK1GQlMUIclYFeBbKggJ9mSwXJH7MIftilGQ8KDvNuV5AbkronGC sEEHj2khs7GfVv4pmUUHf1MRIvV0x3WJkpmhuZaYg8AdJlyGKgp+TQ7B+wCjNTdVqMI1vDk2 BS6Rg851ay7AypbCPx2w4d8jIkQEgNjACHVDU89PNKAjScK1aTnW+HNUqg9BliCvuX5g4z2j gJBs57loTWAGe2Ve3cMy3VoQ40Wt3yKK0Eno8jfgzgb48wyycINZgnseMRhxc2c8hd51tftK LKhPj4c7uqjnBjrgOVaVBupGUmvLiePlnW56zJZ51BR5igWnILeOJ1ZIcf7KsaHyE6B1mG+X dmYtjDhjf3NAcoBWJuj8euxMB6TcQN2MrSXy5wSKaw40evooGwARAQABzSVFcmljIFIuIFNh bmRlZW4gPHNhbmRlZW5Ac2FuZGVlbi5uZXQ+wsF7BBMBAgAlAhsDBgsJCAcDAgYVCAIJCgsE FgIDAQIeAQIXgAUCUzMzbAIZAQAKCRAgrhaS4T3e4Fr7D/wO+fenqVvHjq21SCjDCrt8HdVj aJ28B1SqSU2toxyg5I160GllAxEHpLFGdbFAhQfBtnmlY9eMjwmJb0sCIrkrB6XNPSPA/B2B UPISh0z2od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X5NE3hb+SSwyMSEqJxhVTXJVfQWWW0dQxP7HNwqmOWYF/6m+1gK/Y2gY3jAQnsWTru4RV TZGnKwEPmOCpSUvsTRXsVHgsWJ70qd0yOSjWuiv4b8vmD3+QFgyvCBxPMdP3xsxN5etheLMO gRwWpLn6yNFq/xtgs+ECgG+gR78yXQyA7iCs5tFs2OrMqV5juSMGmn0kxJUAEQEAAcLBXwQY AQIACQUCTrH31AIbDAAKCRAgrhaS4T3e4BKwD/0ZOOmUNOZCSOLAMjZx3mtYtjYgfUNKi0ki YPveGoRWTqbis8UitPtNrG4XxgzLOijSdOEzQwkdOIp/QnZhGNssMejCnsluK0GQd+RkFVWN mcQT78hBeGcnEMAXZKq7bkIKzvc06GFmkMbX/gAl6DiNGv0UNAX+5FYh+ucCJZSyAp3sA+9/ LKjxnTedX0aygXA6rkpX0Y0FvN/9dfm47+LGq7WAqBOyYTU3E6/+Z72bZoG/cG7ANLxcPool LOrU43oqFnD8QwcN56y4VfFj3/jDF2MX3xu4v2OjglVjMEYHTCxP3mpxesGHuqOit/FR+mF0 MP9JGfj6x+bj/9JMBtCW1bY/aPeMdPGTJvXjGtOVYblGZrSjXRn5++Uuy36CvkcrjuziSDG+ JEexGxczWwN4mrOQWhMT5Jyb+18CO+CWxJfHaYXiLEW7dI1AynL4jjn4W0MSiXpWDUw+fsBO Pk6ah10C4+R1Jc7dyUsKksMfvvhRX1hTIXhth85H16706bneTayZBhlZ/hK18uqTX+s0onG/ m1F3vYvdlE4p2ts1mmixMF7KajN9/E5RQtiSArvKTbfsB6Two4MthIuLuf+M0mI4gPl9SPlf fWCYVPhaU9o83y1KFbD/+lh1pjP7bEu/YudBvz7F2Myjh4/9GUAijrCTNeDTDAgvIJDjXuLX pA== Message-ID: <3af22df1-dc37-5e51-36be-aad3fe8a8fbb@sandeen.net> Date: Tue, 8 Jan 2019 08:11:46 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <5c103aa0-8711-ceb3-38f8-dffe983526ff@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/7/19 11:15 PM, Su Yanjun wrote: > > > On 1/8/2019 1:07 PM, Darrick J. Wong wrote: >> On Tue, Jan 08, 2019 at 12:58:43PM +0800, Su Yanjun wrote: >>> >>> On 1/8/2019 2:04 AM, Eric Sandeen wrote: >>>> On 1/7/19 11:52 AM, Darrick J. Wong wrote: >>>>> On Mon, Jan 07, 2019 at 04:53:10AM -0500, Su Yanjun wrote: >>>>>> For statx syscall, xfs return the wrong result_mask. >>>>>> >>>>>> Signed-off-by: Su Yanjun >>>>>> --- >>>>>>    fs/xfs/xfs_iops.c | 3 +++ >>>>>>    1 file changed, 3 insertions(+) >>>>>> >>>>>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c >>>>>> index f48ffd7..3811457 100644 >>>>>> --- a/fs/xfs/xfs_iops.c >>>>>> +++ b/fs/xfs/xfs_iops.c >>>>>> @@ -521,6 +521,9 @@ xfs_vn_getattr( >>>>>>                stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec; >>>>>>            } >>>>>>        } >>>>>> +    >>>>>> +    /* Only return mask that we care */ >>>>>> +    stat->result_mask &= request_mask; >>>>> Why not just: >>>>> >>>>>     stat->result_mask = STATX_BASIC_STATS; >>>>> >>>>> at the top of the function? >>>>> >>>>> I don't see the need to mask off result_mask at all, since we could some >>>>> day elect to return more than what's in request_mask... >>> When we run xfstests with nfs, the generic/423 case runs failed. So i review >>> the nfs' >>> nfs_getattr code it does validate the request_mask. >>> >>> Then i review the xfs' getattr code, it has no such check. Whatever >>> request_mask >>>   is set, the stat's result_mask always the 0x7ff. >> Yes, statx can return more data than what userspace callers ask for: >> >>> Maybe it has Unclear semantics about statx's result_mask. >> "A filesystem may also fill in fields that the caller didn't ask for if >> it has values for them available and the information is available at no >> extra cost.  If this happens, the  corresponding  bits will be set in >> stx_mask." >> >> --D > > I get it, then the testcase generic/423 may need update in xfstests. > Thanks for your reply. Can you please share the details of the failure you're seeing when you run it over nfs? Thanks, -=Eric