Skip to content

Commit 2a2d4b4

Browse files
chucklevergregkh
authored andcommitted
nfs: Fix ugly referral attributes
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: 6b97fd3 ("NFSv4: Follow a referral") Suggested-by: Pradeep Thomas <pradeepthomas@gmail.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ab33df4 commit 2a2d4b4

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

fs/nfs/nfs4proc.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,12 @@ const u32 nfs4_fsinfo_bitmap[3] = { FATTR4_WORD0_MAXFILESIZE
242242
};
243243

244244
const u32 nfs4_fs_locations_bitmap[3] = {
245-
FATTR4_WORD0_TYPE
246-
| FATTR4_WORD0_CHANGE
245+
FATTR4_WORD0_CHANGE
247246
| FATTR4_WORD0_SIZE
248247
| FATTR4_WORD0_FSID
249248
| FATTR4_WORD0_FILEID
250249
| FATTR4_WORD0_FS_LOCATIONS,
251-
FATTR4_WORD1_MODE
252-
| FATTR4_WORD1_NUMLINKS
253-
| FATTR4_WORD1_OWNER
250+
FATTR4_WORD1_OWNER
254251
| FATTR4_WORD1_OWNER_GROUP
255252
| FATTR4_WORD1_RAWDEV
256253
| FATTR4_WORD1_SPACE_USED
@@ -6351,9 +6348,7 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
63516348
struct page *page)
63526349
{
63536350
struct nfs_server *server = NFS_SERVER(dir);
6354-
u32 bitmask[3] = {
6355-
[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
6356-
};
6351+
u32 bitmask[3];
63576352
struct nfs4_fs_locations_arg args = {
63586353
.dir_fh = NFS_FH(dir),
63596354
.name = name,
@@ -6372,12 +6367,15 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
63726367

63736368
dprintk("%s: start\n", __func__);
63746369

6370+
bitmask[0] = nfs4_fattr_bitmap[0] | FATTR4_WORD0_FS_LOCATIONS;
6371+
bitmask[1] = nfs4_fattr_bitmap[1];
6372+
63756373
/* Ask for the fileid of the absent filesystem if mounted_on_fileid
63766374
* is not supported */
63776375
if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
6378-
bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;
6376+
bitmask[0] &= ~FATTR4_WORD0_FILEID;
63796377
else
6380-
bitmask[0] |= FATTR4_WORD0_FILEID;
6378+
bitmask[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
63816379

63826380
nfs_fattr_init(&fs_locations->fattr);
63836381
fs_locations->server = server;

0 commit comments

Comments
 (0)