[PATCH] ceph: fix up endian bug in managing feature bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eduard Shishkin <edward6@xxxxxxxxxxxxx>

In the function handle_session() variable @features always
contains little endian order of bytes. Just because the feature
bits are packed bytewise from left to right in
encode_supported_features().

However, test_bit(), called to check features availability, assumes
the host order of bytes in that variable. This leads to problems on
big endian architectures. Specifically it is impossible to mount
ceph volume on s390.

This patch adds conversion from little endian to the host order
of bytes, thus fixing the problem.

Signed-off-by: Eduard Shishkin <edward6@xxxxxxxxxxxxx>
---
 fs/ceph/mds_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 486f91f..190598d 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3252,7 +3252,7 @@ static void handle_session(struct ceph_mds_session *session,
 	struct ceph_mds_session_head *h;
 	u32 op;
 	u64 seq;
-	unsigned long features = 0;
+	__le64 features = 0;
 	int wake = 0;
 	bool blacklisted = false;
 
@@ -3301,7 +3301,7 @@ static void handle_session(struct ceph_mds_session *session,
 		if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
 			pr_info("mds%d reconnect success\n", session->s_mds);
 		session->s_state = CEPH_MDS_SESSION_OPEN;
-		session->s_features = features;
+		session->s_features = le64_to_cpu(features);
 		renewed_caps(mdsc, session, 0);
 		wake = 1;
 		if (mdsc->stopping)
-- 
1.8.3.1




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux