Received: by 10.223.185.116 with SMTP id b49csp820734wrg; Sat, 10 Feb 2018 21:09:28 -0800 (PST) X-Google-Smtp-Source: AH8x226pQFDnu9jJsUxZOqxDO6w9O22xUIK4MQ5E0dgPyRdVXICeyKXHxvUF4nPUI1ZwoiXlizZL X-Received: by 10.101.96.71 with SMTP id b7mr6531894pgv.339.1518325768064; Sat, 10 Feb 2018 21:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518325768; cv=none; d=google.com; s=arc-20160816; b=Uw37FN0lKaVPhsPL2LgD0uPqmLsSVFRnTh++hk4BcnsoFP3rnnKtKQYk6Fu6DiDspT N7VfIG49gi7FGu9XeH/4/5r9GsXBSitfLw/3JfB6IZ07+aoAyqfQ0+Ks+1ZgvdTY+LN6 J+wLF9zHgyRmQZqXaaRWsoVHLfHKG6QEXhYCprMrrLIuZ/52W8ea+Gloqya7kYSfv7bx L3CH6tWs6I7qLmUW656dlKwvn4qnKSNoOWzfwcE09j9HY3vjGmQMu0WdLo2VBzQrnHer I9DTVB5mOUOapDOW6IesDS3WlADaMhT/UwtJd/tf9wbsRPfh1g4ewx1FFcakdNIO2cbj Hiuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=SGtdVcGJmNR8gZtD5V1HMAc1rOHctHfovzasL/4Sljw=; b=vX+AQIi2G/PLLLClXRSI7dm7fOWn93OBbXhpq10KwBZyfyIyp8X/yc3ZethMI3iHlZ AoQDeiK1eDTg7YqrY95yDcmEKac86KMTLx+aX0MxF80nke5oxL8wzkWuCyyd/X3CUUxb zEVj8av5VGjwxl8gZWyIWGXjWo8G8e+ISQcmYApNp9SQh+z60V6Ky550+c/kfayiv8N0 rIGxuKa0qIN8NkmkUq3gFGpdlnk+io7K4vMo4xc06xQS/vv5WeiftydBdkXzAfUDukXF PKSwHxmH3rRuAuH97yYNbTvRvA9fEFkNDXj/OnfDEFUU76WTr8aN3r6lFSPqbtGrrbpN WHfg== 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 d21-v6si3956391pll.268.2018.02.10.21.09.13; Sat, 10 Feb 2018 21:09:28 -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 S1753818AbeBKFHd (ORCPT + 99 others); Sun, 11 Feb 2018 00:07:33 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41466 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752660AbeBKEdm (ORCPT ); Sat, 10 Feb 2018 23:33:42 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ekjKd-0002hN-Qv; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKY-0004VI-9e; Sun, 11 Feb 2018 04:33:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Chuck Lever" , "Pradeep Thomas" , "Anna Schumaker" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 48/79] nfs: Fix ugly referral attributes In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Chuck Lever commit c05cefcc72416a37eba5a2b35f0704ed758a9145 upstream. Before traversing a referral and performing a mount, the mounted-on directory looks strange: dr-xr-xr-x. 2 4294967294 4294967294 0 Dec 31 1969 dir.0 nfs4_get_referral is wiping out any cached attributes with what was returned via GETATTR(fs_locations), but the bit mask for that operation does not request any file attributes. Retrieve owner and timestamp information so that the memcpy in nfs4_get_referral fills in more attributes. Changes since v1: - Don't request attributes that the client unconditionally replaces - Request only MOUNTED_ON_FILEID or FILEID attribute, not both - encode_fs_locations() doesn't use the third bitmask word Fixes: 6b97fd3da1ea ("NFSv4: Follow a referral") Suggested-by: Pradeep Thomas Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings --- fs/nfs/nfs4proc.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -151,15 +151,12 @@ const u32 nfs4_fsinfo_bitmap[3] = { FATT }; const u32 nfs4_fs_locations_bitmap[2] = { - FATTR4_WORD0_TYPE - | FATTR4_WORD0_CHANGE + FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID | FATTR4_WORD0_FS_LOCATIONS, - FATTR4_WORD1_MODE - | FATTR4_WORD1_NUMLINKS - | FATTR4_WORD1_OWNER + FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV | FATTR4_WORD1_SPACE_USED @@ -4805,9 +4802,7 @@ int nfs4_proc_fs_locations(struct inode struct nfs4_fs_locations *fs_locations, struct page *page) { struct nfs_server *server = NFS_SERVER(dir); - u32 bitmask[2] = { - [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, - }; + u32 bitmask[2]; struct nfs4_fs_locations_arg args = { .dir_fh = NFS_FH(dir), .name = name, @@ -4826,12 +4821,15 @@ int nfs4_proc_fs_locations(struct inode dprintk("%s: start\n", __func__); + bitmask[0] = nfs4_fattr_bitmap[0] | FATTR4_WORD0_FS_LOCATIONS; + bitmask[1] = nfs4_fattr_bitmap[1]; + /* Ask for the fileid of the absent filesystem if mounted_on_fileid * is not supported */ if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) - bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID; + bitmask[0] &= ~FATTR4_WORD0_FILEID; else - bitmask[0] |= FATTR4_WORD0_FILEID; + bitmask[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; nfs_fattr_init(&fs_locations->fattr); fs_locations->server = server;