ceph: hex dump corrupt server data to KERN_DEBUG
authorSage Weil <sage@newdream.net>
Mon, 14 Dec 2009 23:13:47 +0000 (15:13 -0800)
committerSage Weil <sage@newdream.net>
Tue, 22 Dec 2009 00:39:52 +0000 (16:39 -0800)
Also, print fsid using standard format, NOT hex dump.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/caps.c
fs/ceph/mds_client.c
fs/ceph/mdsmap.c
fs/ceph/messenger.c
fs/ceph/messenger.h
fs/ceph/mon_client.c
fs/ceph/osd_client.c
fs/ceph/osdmap.c
fs/ceph/snap.c
fs/ceph/super.c

index 9b9ce143ac1fe38cd52e7d77122ae370ec4a136a..dfb509f53542a19ead1fea327a60db05e2921470 100644 (file)
@@ -2681,6 +2681,7 @@ done:
 
 bad:
        pr_err("ceph_handle_caps: corrupt message\n");
+       ceph_msg_dump(msg);
        return;
 }
 
index 739093f281d0c9a010af53e09466f5413b3c2cd8..29a93fe35f853214c5b26c388a76c96500f1273f 100644 (file)
@@ -1650,6 +1650,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
                return;
        if (msg->front.iov_len < sizeof(*head)) {
                pr_err("mdsc_handle_reply got corrupt (short) reply\n");
+               ceph_msg_dump(msg);
                return;
        }
 
@@ -1740,6 +1741,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
        mutex_lock(&session->s_mutex);
        if (err < 0) {
                pr_err("mdsc_handle_reply got corrupt reply mds%d\n", mds);
+               ceph_msg_dump(msg);
                goto out_err;
        }
 
@@ -1929,6 +1931,7 @@ static void handle_session(struct ceph_mds_session *session,
 bad:
        pr_err("mdsc_handle_session corrupt message mds%d len %d\n", mds,
               (int)msg->front.iov_len);
+       ceph_msg_dump(msg);
        return;
 }
 
@@ -2394,6 +2397,7 @@ out:
 
 bad:
        pr_err("corrupt lease message\n");
+       ceph_msg_dump(msg);
 }
 
 void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,
index cad8d25861e5d52290e3533f83d0859170539a26..c4c498e6dfefe50668f0575df203e11b93e6294c 100644 (file)
@@ -49,6 +49,7 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
 struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
 {
        struct ceph_mdsmap *m;
+       const void *start = *p;
        int i, j, n;
        int err = -EINVAL;
        u16 version;
@@ -154,6 +155,9 @@ badmem:
        err = -ENOMEM;
 bad:
        pr_err("corrupt mdsmap\n");
+       print_hex_dump(KERN_DEBUG, "mdsmap: ",
+                      DUMP_PREFIX_OFFSET, 16, 1,
+                      start, end - start, true);
        ceph_mdsmap_destroy(m);
        return ERR_PTR(-EINVAL);
 }
index d5eef76a253ceb5d6c1347199974b8e96b9005f7..b10f88c5670647de4eb1e75df3d5af122c98e668 100644 (file)
@@ -2115,3 +2115,23 @@ void ceph_msg_last_put(struct kref *kref)
        else
                ceph_msg_kfree(m);
 }
+
+void ceph_msg_dump(struct ceph_msg *msg)
+{
+       pr_debug("msg_dump %p (front_max %d nr_pages %d)\n", msg,
+                msg->front_max, msg->nr_pages);
+       print_hex_dump(KERN_DEBUG, "header: ",
+                      DUMP_PREFIX_OFFSET, 16, 1,
+                      &msg->hdr, sizeof(msg->hdr), true);
+       print_hex_dump(KERN_DEBUG, " front: ",
+                      DUMP_PREFIX_OFFSET, 16, 1,
+                      msg->front.iov_base, msg->front.iov_len, true);
+       if (msg->middle)
+               print_hex_dump(KERN_DEBUG, "middle: ",
+                              DUMP_PREFIX_OFFSET, 16, 1,
+                              msg->middle->vec.iov_base,
+                              msg->middle->vec.iov_len, true);
+       print_hex_dump(KERN_DEBUG, "footer: ",
+                      DUMP_PREFIX_OFFSET, 16, 1,
+                      &msg->footer, sizeof(msg->footer), true);
+}
index eff5cb5197fc1dbc603c2b22894994c68f10dbee..e04c214b4f6f000fb14a7230444656d0ea3f0668 100644 (file)
@@ -254,4 +254,6 @@ static inline void ceph_msg_put(struct ceph_msg *msg)
        kref_put(&msg->kref, ceph_msg_last_put);
 }
 
+extern void ceph_msg_dump(struct ceph_msg *msg);
+
 #endif
index a76da5e6dbdd0016f0b0f67b239ef6983c7e2114..775a9c029c514d18b64d87dbd5855a6cfbefef8b 100644 (file)
@@ -242,6 +242,7 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc,
        return;
 bad:
        pr_err("got corrupt subscribe-ack msg\n");
+       ceph_msg_dump(msg);
 }
 
 /*
@@ -364,6 +365,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc,
 
 bad:
        pr_err("corrupt statfs reply, no tid\n");
+       ceph_msg_dump(msg);
 }
 
 /*
index 63482ef3de01913a9fb525f7029059d74489e56a..4bfe880d53c8a3266504ec4545039f75a20116e7 100644 (file)
@@ -773,6 +773,7 @@ bad:
        pr_err("corrupt osd_op_reply got %d %d expected %d\n",
               (int)msg->front.iov_len, le32_to_cpu(msg->hdr.front_len),
               (int)sizeof(*rhead));
+       ceph_msg_dump(msg);
 }
 
 
@@ -964,6 +965,7 @@ done:
 
 bad:
        pr_err("osdc handle_map corrupt msg\n");
+       ceph_msg_dump(msg);
        up_write(&osdc->map_sem);
        return;
 }
index be5318aa77141381a15410131a11fc7d577915a0..8c8ffe5ef7d4442105aecf333ff844c1ea60236a 100644 (file)
@@ -726,6 +726,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
 bad:
        pr_err("corrupt inc osdmap epoch %d off %d (%p of %p-%p)\n",
               epoch, (int)(*p - start), *p, start, end);
+       print_hex_dump(KERN_DEBUG, "osdmap: ",
+                      DUMP_PREFIX_OFFSET, 16, 1,
+                      start, end - start, true);
        if (newcrush)
                crush_destroy(newcrush);
        return ERR_PTR(err);
index 52f46a1208f5ea34864d7ae0bf837e27d75c0269..dcf18d92130a2c56dba4f1d92453abdcff828cd1 100644 (file)
@@ -877,6 +877,7 @@ split_skip_inode:
 
 bad:
        pr_err("corrupt snap message from mds%d\n", mds);
+       ceph_msg_dump(msg);
 out:
        if (locked_rwsem)
                up_write(&mdsc->snap_rwsem);
index a828943296c50b4820889de52543a18b91d30a59..6d02a166f8ffe6d61068ced19f030063311d9408 100644 (file)
@@ -602,13 +602,8 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
 {
        if (client->have_fsid) {
                if (ceph_fsid_compare(&client->fsid, fsid)) {
-                       print_hex_dump(KERN_ERR, "this fsid: ",
-                                      DUMP_PREFIX_NONE, 16, 1,
-                                      (void *)fsid, 16, 0);
-                       print_hex_dump(KERN_ERR, " old fsid: ",
-                                      DUMP_PREFIX_NONE, 16, 1,
-                                      (void *)&client->fsid, 16, 0);
-                       pr_err("fsid mismatch\n");
+                       pr_err("bad fsid, had " FSID_FORMAT " got " FSID_FORMAT,
+                              PR_FSID(&client->fsid), PR_FSID(fsid));
                        return -1;
                }
        } else {