]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.85/nfs-fix-ugly-referral-attributes.patch
Drop nfc patches from older trees
[thirdparty/kernel/stable-queue.git] / releases / 3.18.85 / nfs-fix-ugly-referral-attributes.patch
CommitLineData
d992de84
GKH
1From c05cefcc72416a37eba5a2b35f0704ed758a9145 Mon Sep 17 00:00:00 2001
2From: Chuck Lever <chuck.lever@oracle.com>
3Date: Sun, 5 Nov 2017 15:45:22 -0500
4Subject: nfs: Fix ugly referral attributes
5
6From: Chuck Lever <chuck.lever@oracle.com>
7
8commit c05cefcc72416a37eba5a2b35f0704ed758a9145 upstream.
9
10Before traversing a referral and performing a mount, the mounted-on
11directory looks strange:
12
13dr-xr-xr-x. 2 4294967294 4294967294 0 Dec 31 1969 dir.0
14
15nfs4_get_referral is wiping out any cached attributes with what was
16returned via GETATTR(fs_locations), but the bit mask for that
17operation does not request any file attributes.
18
19Retrieve owner and timestamp information so that the memcpy in
20nfs4_get_referral fills in more attributes.
21
22Changes since v1:
23- Don't request attributes that the client unconditionally replaces
24- Request only MOUNTED_ON_FILEID or FILEID attribute, not both
25- encode_fs_locations() doesn't use the third bitmask word
26
27Fixes: 6b97fd3da1ea ("NFSv4: Follow a referral")
28Suggested-by: Pradeep Thomas <pradeepthomas@gmail.com>
29Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
30Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
31Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32
33---
34 fs/nfs/nfs4proc.c | 18 ++++++++----------
35 1 file changed, 8 insertions(+), 10 deletions(-)
36
37--- a/fs/nfs/nfs4proc.c
38+++ b/fs/nfs/nfs4proc.c
39@@ -243,15 +243,12 @@ const u32 nfs4_fsinfo_bitmap[3] = { FATT
40 };
41
42 const u32 nfs4_fs_locations_bitmap[3] = {
43- FATTR4_WORD0_TYPE
44- | FATTR4_WORD0_CHANGE
45+ FATTR4_WORD0_CHANGE
46 | FATTR4_WORD0_SIZE
47 | FATTR4_WORD0_FSID
48 | FATTR4_WORD0_FILEID
49 | FATTR4_WORD0_FS_LOCATIONS,
50- FATTR4_WORD1_MODE
51- | FATTR4_WORD1_NUMLINKS
52- | FATTR4_WORD1_OWNER
53+ FATTR4_WORD1_OWNER
54 | FATTR4_WORD1_OWNER_GROUP
55 | FATTR4_WORD1_RAWDEV
56 | FATTR4_WORD1_SPACE_USED
57@@ -6143,9 +6140,7 @@ static int _nfs4_proc_fs_locations(struc
58 struct page *page)
59 {
60 struct nfs_server *server = NFS_SERVER(dir);
61- u32 bitmask[3] = {
62- [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
63- };
64+ u32 bitmask[3];
65 struct nfs4_fs_locations_arg args = {
66 .dir_fh = NFS_FH(dir),
67 .name = name,
68@@ -6164,12 +6159,15 @@ static int _nfs4_proc_fs_locations(struc
69
70 dprintk("%s: start\n", __func__);
71
72+ bitmask[0] = nfs4_fattr_bitmap[0] | FATTR4_WORD0_FS_LOCATIONS;
73+ bitmask[1] = nfs4_fattr_bitmap[1];
74+
75 /* Ask for the fileid of the absent filesystem if mounted_on_fileid
76 * is not supported */
77 if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
78- bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;
79+ bitmask[0] &= ~FATTR4_WORD0_FILEID;
80 else
81- bitmask[0] |= FATTR4_WORD0_FILEID;
82+ bitmask[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
83
84 nfs_fattr_init(&fs_locations->fattr);
85 fs_locations->server = server;