diff mbox series

[v3,1/2] ceph: add status debug file support

Message ID 20201110141703.414211-2-xiubli@redhat.com
State New
Headers show
Series ceph: add vxattrs to get ids and status debug file support | expand

Commit Message

Xiubo Li Nov. 10, 2020, 2:17 p.m. UTC
From: Xiubo Li <xiubli@redhat.com>

This will help list some useful client side info, like the client
entity address/name and bloclisted status, etc.

URL: https://tracker.ceph.com/issues/48057
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/debugfs.c | 20 ++++++++++++++++++++
 fs/ceph/super.h   |  1 +
 2 files changed, 21 insertions(+)

Comments

Patrick Donnelly Nov. 13, 2020, 7:42 p.m. UTC | #1
On Tue, Nov 10, 2020 at 6:17 AM <xiubli@redhat.com> wrote:
>

> From: Xiubo Li <xiubli@redhat.com>

>

> This will help list some useful client side info, like the client

> entity address/name and bloclisted status, etc.

>

> URL: https://tracker.ceph.com/issues/48057


Thanks for working on this Xiubo. Do we have an Ceph PR for updating
the QA bits to use this?

-- 
Patrick Donnelly, Ph.D.
He / Him / His
Principal Software Engineer
Red Hat Sunnyvale, CA
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
Xiubo Li Nov. 16, 2020, 4:34 a.m. UTC | #2
On 2020/11/14 3:42, Patrick Donnelly wrote:
> On Tue, Nov 10, 2020 at 6:17 AM <xiubli@redhat.com> wrote:

>> From: Xiubo Li <xiubli@redhat.com>

>>

>> This will help list some useful client side info, like the client

>> entity address/name and bloclisted status, etc.

>>

>> URL: https://tracker.ceph.com/issues/48057

> Thanks for working on this Xiubo. Do we have an Ceph PR for updating

> the QA bits to use this?

>

Not yet. I will raise one.

Thanks
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 7a8fbe3e4751..4e498a492de4 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -304,11 +304,25 @@  static int mds_sessions_show(struct seq_file *s, void *ptr)
 	return 0;
 }
 
+static int status_show(struct seq_file *s, void *p)
+{
+	struct ceph_fs_client *fsc = s->private;
+	struct ceph_entity_inst *inst = &fsc->client->msgr.inst;
+	struct ceph_entity_addr *client_addr = ceph_client_addr(fsc->client);
+
+	seq_printf(s, "inst_str: %s.%lld %s/%u\n", ENTITY_NAME(inst->name),
+		   ceph_pr_addr(client_addr), le32_to_cpu(client_addr->nonce));
+	seq_printf(s, "blocklisted: %s\n", fsc->blocklisted ? "true" : "false");
+
+	return 0;
+}
+
 DEFINE_SHOW_ATTRIBUTE(mdsmap);
 DEFINE_SHOW_ATTRIBUTE(mdsc);
 DEFINE_SHOW_ATTRIBUTE(caps);
 DEFINE_SHOW_ATTRIBUTE(mds_sessions);
 DEFINE_SHOW_ATTRIBUTE(metric);
+DEFINE_SHOW_ATTRIBUTE(status);
 
 
 /*
@@ -394,6 +408,12 @@  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 						fsc->client->debugfs_dir,
 						fsc,
 						&caps_fops);
+
+	fsc->debugfs_status = debugfs_create_file("status",
+						  0400,
+						  fsc->client->debugfs_dir,
+						  fsc,
+						  &status_fops);
 }
 
 
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index f097237a5ad3..5138b75923f9 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -128,6 +128,7 @@  struct ceph_fs_client {
 	struct dentry *debugfs_bdi;
 	struct dentry *debugfs_mdsc, *debugfs_mdsmap;
 	struct dentry *debugfs_metric;
+	struct dentry *debugfs_status;
 	struct dentry *debugfs_mds_sessions;
 #endif