Skip to content

Commit 0fa8263

Browse files
jtlaytonidryomov
authored andcommitted
ceph: fix endianness bug when handling MDS session feature bits
Eduard reported a problem mounting cephfs on s390 arch. The feature mask sent by the MDS is little-endian, so we need to convert it before storing and testing against it. Cc: [email protected] Reported-and-Tested-by: Eduard Shishkin <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: "Yan, Zheng" <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 0e698df commit 0fa8263

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/ceph/mds_client.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,8 +3251,7 @@ static void handle_session(struct ceph_mds_session *session,
32513251
void *end = p + msg->front.iov_len;
32523252
struct ceph_mds_session_head *h;
32533253
u32 op;
3254-
u64 seq;
3255-
unsigned long features = 0;
3254+
u64 seq, features = 0;
32563255
int wake = 0;
32573256
bool blacklisted = false;
32583257

@@ -3271,9 +3270,8 @@ static void handle_session(struct ceph_mds_session *session,
32713270
goto bad;
32723271
/* version >= 3, feature bits */
32733272
ceph_decode_32_safe(&p, end, len, bad);
3274-
ceph_decode_need(&p, end, len, bad);
3275-
memcpy(&features, p, min_t(size_t, len, sizeof(features)));
3276-
p += len;
3273+
ceph_decode_64_safe(&p, end, features, bad);
3274+
p += len - sizeof(features);
32773275
}
32783276

32793277
mutex_lock(&mdsc->mutex);

0 commit comments

Comments
 (0)