diff options
author | Sage Weil <sage@newdream.net> | 2009-12-14 18:13:47 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-21 19:39:52 -0500 |
commit | 9ec7cab14e6de732d4e7c355fe67c5810c32c758 (patch) | |
tree | 2f512034bc7db2b4ca8fe47ceea06ac99a8cab40 | |
parent | 93c20d98c29ccefa039c3843ccc37122caaf3d31 (diff) |
ceph: hex dump corrupt server data to KERN_DEBUG
Also, print fsid using standard format, NOT hex dump.
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | fs/ceph/caps.c | 1 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 4 | ||||
-rw-r--r-- | fs/ceph/mdsmap.c | 4 | ||||
-rw-r--r-- | fs/ceph/messenger.c | 20 | ||||
-rw-r--r-- | fs/ceph/messenger.h | 2 | ||||
-rw-r--r-- | fs/ceph/mon_client.c | 2 | ||||
-rw-r--r-- | fs/ceph/osd_client.c | 2 | ||||
-rw-r--r-- | fs/ceph/osdmap.c | 3 | ||||
-rw-r--r-- | fs/ceph/snap.c | 1 | ||||
-rw-r--r-- | fs/ceph/super.c | 9 |
10 files changed, 41 insertions, 7 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 9b9ce143ac1f..dfb509f53542 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2681,6 +2681,7 @@ done: | |||
2681 | 2681 | ||
2682 | bad: | 2682 | bad: |
2683 | pr_err("ceph_handle_caps: corrupt message\n"); | 2683 | pr_err("ceph_handle_caps: corrupt message\n"); |
2684 | ceph_msg_dump(msg); | ||
2684 | return; | 2685 | return; |
2685 | } | 2686 | } |
2686 | 2687 | ||
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 739093f281d0..29a93fe35f85 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1650,6 +1650,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
1650 | return; | 1650 | return; |
1651 | if (msg->front.iov_len < sizeof(*head)) { | 1651 | if (msg->front.iov_len < sizeof(*head)) { |
1652 | pr_err("mdsc_handle_reply got corrupt (short) reply\n"); | 1652 | pr_err("mdsc_handle_reply got corrupt (short) reply\n"); |
1653 | ceph_msg_dump(msg); | ||
1653 | return; | 1654 | return; |
1654 | } | 1655 | } |
1655 | 1656 | ||
@@ -1740,6 +1741,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
1740 | mutex_lock(&session->s_mutex); | 1741 | mutex_lock(&session->s_mutex); |
1741 | if (err < 0) { | 1742 | if (err < 0) { |
1742 | pr_err("mdsc_handle_reply got corrupt reply mds%d\n", mds); | 1743 | pr_err("mdsc_handle_reply got corrupt reply mds%d\n", mds); |
1744 | ceph_msg_dump(msg); | ||
1743 | goto out_err; | 1745 | goto out_err; |
1744 | } | 1746 | } |
1745 | 1747 | ||
@@ -1929,6 +1931,7 @@ static void handle_session(struct ceph_mds_session *session, | |||
1929 | bad: | 1931 | bad: |
1930 | pr_err("mdsc_handle_session corrupt message mds%d len %d\n", mds, | 1932 | pr_err("mdsc_handle_session corrupt message mds%d len %d\n", mds, |
1931 | (int)msg->front.iov_len); | 1933 | (int)msg->front.iov_len); |
1934 | ceph_msg_dump(msg); | ||
1932 | return; | 1935 | return; |
1933 | } | 1936 | } |
1934 | 1937 | ||
@@ -2394,6 +2397,7 @@ out: | |||
2394 | 2397 | ||
2395 | bad: | 2398 | bad: |
2396 | pr_err("corrupt lease message\n"); | 2399 | pr_err("corrupt lease message\n"); |
2400 | ceph_msg_dump(msg); | ||
2397 | } | 2401 | } |
2398 | 2402 | ||
2399 | void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session, | 2403 | void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session, |
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index cad8d25861e5..c4c498e6dfef 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c | |||
@@ -49,6 +49,7 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m) | |||
49 | struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | 49 | struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) |
50 | { | 50 | { |
51 | struct ceph_mdsmap *m; | 51 | struct ceph_mdsmap *m; |
52 | const void *start = *p; | ||
52 | int i, j, n; | 53 | int i, j, n; |
53 | int err = -EINVAL; | 54 | int err = -EINVAL; |
54 | u16 version; | 55 | u16 version; |
@@ -154,6 +155,9 @@ badmem: | |||
154 | err = -ENOMEM; | 155 | err = -ENOMEM; |
155 | bad: | 156 | bad: |
156 | pr_err("corrupt mdsmap\n"); | 157 | pr_err("corrupt mdsmap\n"); |
158 | print_hex_dump(KERN_DEBUG, "mdsmap: ", | ||
159 | DUMP_PREFIX_OFFSET, 16, 1, | ||
160 | start, end - start, true); | ||
157 | ceph_mdsmap_destroy(m); | 161 | ceph_mdsmap_destroy(m); |
158 | return ERR_PTR(-EINVAL); | 162 | return ERR_PTR(-EINVAL); |
159 | } | 163 | } |
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index d5eef76a253c..b10f88c56706 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -2115,3 +2115,23 @@ void ceph_msg_last_put(struct kref *kref) | |||
2115 | else | 2115 | else |
2116 | ceph_msg_kfree(m); | 2116 | ceph_msg_kfree(m); |
2117 | } | 2117 | } |
2118 | |||
2119 | void ceph_msg_dump(struct ceph_msg *msg) | ||
2120 | { | ||
2121 | pr_debug("msg_dump %p (front_max %d nr_pages %d)\n", msg, | ||
2122 | msg->front_max, msg->nr_pages); | ||
2123 | print_hex_dump(KERN_DEBUG, "header: ", | ||
2124 | DUMP_PREFIX_OFFSET, 16, 1, | ||
2125 | &msg->hdr, sizeof(msg->hdr), true); | ||
2126 | print_hex_dump(KERN_DEBUG, " front: ", | ||
2127 | DUMP_PREFIX_OFFSET, 16, 1, | ||
2128 | msg->front.iov_base, msg->front.iov_len, true); | ||
2129 | if (msg->middle) | ||
2130 | print_hex_dump(KERN_DEBUG, "middle: ", | ||
2131 | DUMP_PREFIX_OFFSET, 16, 1, | ||
2132 | msg->middle->vec.iov_base, | ||
2133 | msg->middle->vec.iov_len, true); | ||
2134 | print_hex_dump(KERN_DEBUG, "footer: ", | ||
2135 | DUMP_PREFIX_OFFSET, 16, 1, | ||
2136 | &msg->footer, sizeof(msg->footer), true); | ||
2137 | } | ||
diff --git a/fs/ceph/messenger.h b/fs/ceph/messenger.h index eff5cb5197fc..e04c214b4f6f 100644 --- a/fs/ceph/messenger.h +++ b/fs/ceph/messenger.h | |||
@@ -254,4 +254,6 @@ static inline void ceph_msg_put(struct ceph_msg *msg) | |||
254 | kref_put(&msg->kref, ceph_msg_last_put); | 254 | kref_put(&msg->kref, ceph_msg_last_put); |
255 | } | 255 | } |
256 | 256 | ||
257 | extern void ceph_msg_dump(struct ceph_msg *msg); | ||
258 | |||
257 | #endif | 259 | #endif |
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index a76da5e6dbdd..775a9c029c51 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
@@ -242,6 +242,7 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc, | |||
242 | return; | 242 | return; |
243 | bad: | 243 | bad: |
244 | pr_err("got corrupt subscribe-ack msg\n"); | 244 | pr_err("got corrupt subscribe-ack msg\n"); |
245 | ceph_msg_dump(msg); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | /* | 248 | /* |
@@ -364,6 +365,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc, | |||
364 | 365 | ||
365 | bad: | 366 | bad: |
366 | pr_err("corrupt statfs reply, no tid\n"); | 367 | pr_err("corrupt statfs reply, no tid\n"); |
368 | ceph_msg_dump(msg); | ||
367 | } | 369 | } |
368 | 370 | ||
369 | /* | 371 | /* |
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c index 63482ef3de01..4bfe880d53c8 100644 --- a/fs/ceph/osd_client.c +++ b/fs/ceph/osd_client.c | |||
@@ -773,6 +773,7 @@ bad: | |||
773 | pr_err("corrupt osd_op_reply got %d %d expected %d\n", | 773 | pr_err("corrupt osd_op_reply got %d %d expected %d\n", |
774 | (int)msg->front.iov_len, le32_to_cpu(msg->hdr.front_len), | 774 | (int)msg->front.iov_len, le32_to_cpu(msg->hdr.front_len), |
775 | (int)sizeof(*rhead)); | 775 | (int)sizeof(*rhead)); |
776 | ceph_msg_dump(msg); | ||
776 | } | 777 | } |
777 | 778 | ||
778 | 779 | ||
@@ -964,6 +965,7 @@ done: | |||
964 | 965 | ||
965 | bad: | 966 | bad: |
966 | pr_err("osdc handle_map corrupt msg\n"); | 967 | pr_err("osdc handle_map corrupt msg\n"); |
968 | ceph_msg_dump(msg); | ||
967 | up_write(&osdc->map_sem); | 969 | up_write(&osdc->map_sem); |
968 | return; | 970 | return; |
969 | } | 971 | } |
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index be5318aa7714..8c8ffe5ef7d4 100644 --- a/fs/ceph/osdmap.c +++ b/fs/ceph/osdmap.c | |||
@@ -726,6 +726,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
726 | bad: | 726 | bad: |
727 | pr_err("corrupt inc osdmap epoch %d off %d (%p of %p-%p)\n", | 727 | pr_err("corrupt inc osdmap epoch %d off %d (%p of %p-%p)\n", |
728 | epoch, (int)(*p - start), *p, start, end); | 728 | epoch, (int)(*p - start), *p, start, end); |
729 | print_hex_dump(KERN_DEBUG, "osdmap: ", | ||
730 | DUMP_PREFIX_OFFSET, 16, 1, | ||
731 | start, end - start, true); | ||
729 | if (newcrush) | 732 | if (newcrush) |
730 | crush_destroy(newcrush); | 733 | crush_destroy(newcrush); |
731 | return ERR_PTR(err); | 734 | return ERR_PTR(err); |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 52f46a1208f5..dcf18d92130a 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -877,6 +877,7 @@ split_skip_inode: | |||
877 | 877 | ||
878 | bad: | 878 | bad: |
879 | pr_err("corrupt snap message from mds%d\n", mds); | 879 | pr_err("corrupt snap message from mds%d\n", mds); |
880 | ceph_msg_dump(msg); | ||
880 | out: | 881 | out: |
881 | if (locked_rwsem) | 882 | if (locked_rwsem) |
882 | up_write(&mdsc->snap_rwsem); | 883 | up_write(&mdsc->snap_rwsem); |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index a828943296c5..6d02a166f8ff 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -602,13 +602,8 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid) | |||
602 | { | 602 | { |
603 | if (client->have_fsid) { | 603 | if (client->have_fsid) { |
604 | if (ceph_fsid_compare(&client->fsid, fsid)) { | 604 | if (ceph_fsid_compare(&client->fsid, fsid)) { |
605 | print_hex_dump(KERN_ERR, "this fsid: ", | 605 | pr_err("bad fsid, had " FSID_FORMAT " got " FSID_FORMAT, |
606 | DUMP_PREFIX_NONE, 16, 1, | 606 | PR_FSID(&client->fsid), PR_FSID(fsid)); |
607 | (void *)fsid, 16, 0); | ||
608 | print_hex_dump(KERN_ERR, " old fsid: ", | ||
609 | DUMP_PREFIX_NONE, 16, 1, | ||
610 | (void *)&client->fsid, 16, 0); | ||
611 | pr_err("fsid mismatch\n"); | ||
612 | return -1; | 607 | return -1; |
613 | } | 608 | } |
614 | } else { | 609 | } else { |