Skip to content

Commit c05cefc

Browse files
chuckleveramschuma-ntap
authored andcommitted
nfs: Fix ugly referral attributes
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 <[email protected]> Signed-off-by: Chuck Lever <[email protected]> Cc: [email protected] Signed-off-by: Anna Schumaker <[email protected]>
1 parent fd53dde commit c05cefc

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

fs/nfs/nfs4proc.c

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

260260
const u32 nfs4_fs_locations_bitmap[3] = {
261-
FATTR4_WORD0_TYPE
262-
| FATTR4_WORD0_CHANGE
261+
FATTR4_WORD0_CHANGE
263262
| FATTR4_WORD0_SIZE
264263
| FATTR4_WORD0_FSID
265264
| FATTR4_WORD0_FILEID
266265
| FATTR4_WORD0_FS_LOCATIONS,
267-
FATTR4_WORD1_MODE
268-
| FATTR4_WORD1_NUMLINKS
269-
| FATTR4_WORD1_OWNER
266+
FATTR4_WORD1_OWNER
270267
| FATTR4_WORD1_OWNER_GROUP
271268
| FATTR4_WORD1_RAWDEV
272269
| FATTR4_WORD1_SPACE_USED
@@ -6907,9 +6904,7 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
69076904
struct page *page)
69086905
{
69096906
struct nfs_server *server = NFS_SERVER(dir);
6910-
u32 bitmask[3] = {
6911-
[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
6912-
};
6907+
u32 bitmask[3];
69136908
struct nfs4_fs_locations_arg args = {
69146909
.dir_fh = NFS_FH(dir),
69156910
.name = name,
@@ -6928,12 +6923,15 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
69286923

69296924
dprintk("%s: start\n", __func__);
69306925

6926+
bitmask[0] = nfs4_fattr_bitmap[0] | FATTR4_WORD0_FS_LOCATIONS;
6927+
bitmask[1] = nfs4_fattr_bitmap[1];
6928+
69316929
/* Ask for the fileid of the absent filesystem if mounted_on_fileid
69326930
* is not supported */
69336931
if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
6934-
bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;
6932+
bitmask[0] &= ~FATTR4_WORD0_FILEID;
69356933
else
6936-
bitmask[0] |= FATTR4_WORD0_FILEID;
6934+
bitmask[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
69376935

69386936
nfs_fattr_init(&fs_locations->fattr);
69396937
fs_locations->server = server;

0 commit comments

Comments
 (0)