]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.103/nfs-fix-ugly-referral-attributes.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.103 / nfs-fix-ugly-referral-attributes.patch
1 From c05cefcc72416a37eba5a2b35f0704ed758a9145 Mon Sep 17 00:00:00 2001
2 From: Chuck Lever <chuck.lever@oracle.com>
3 Date: Sun, 5 Nov 2017 15:45:22 -0500
4 Subject: nfs: Fix ugly referral attributes
5
6 From: Chuck Lever <chuck.lever@oracle.com>
7
8 commit c05cefcc72416a37eba5a2b35f0704ed758a9145 upstream.
9
10 Before traversing a referral and performing a mount, the mounted-on
11 directory looks strange:
12
13 dr-xr-xr-x. 2 4294967294 4294967294 0 Dec 31 1969 dir.0
14
15 nfs4_get_referral is wiping out any cached attributes with what was
16 returned via GETATTR(fs_locations), but the bit mask for that
17 operation does not request any file attributes.
18
19 Retrieve owner and timestamp information so that the memcpy in
20 nfs4_get_referral fills in more attributes.
21
22 Changes 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
27 Fixes: 6b97fd3da1ea ("NFSv4: Follow a referral")
28 Suggested-by: Pradeep Thomas <pradeepthomas@gmail.com>
29 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
30 Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
31 Signed-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 @@ -242,15 +242,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 @@ -6351,9 +6348,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 @@ -6372,12 +6367,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;