From 23b5c0639e7a05c493ea36456d597ab51aa4aa7d Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 17 Mar 2009 11:09:18 -0700 Subject: [PATCH] kclient: fix statfs sysfs entries init/cleanup --- src/kernel/mon_client.c | 3 ++- src/kernel/super.h | 3 ++- src/kernel/sysfs.c | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/kernel/mon_client.c b/src/kernel/mon_client.c index a243160363539..5a33a5f0d793d 100644 --- a/src/kernel/mon_client.c +++ b/src/kernel/mon_client.c @@ -329,7 +329,7 @@ static int send_statfs(struct ceph_mon_client *monc, h->fsid = monc->monmap->fsid; h->tid = cpu_to_le64(req->tid); msg->hdr.dst = monc->monmap->mon_inst[mon]; - ceph_sysfs_mon_statfs_req_init(monc, req, msg); + ceph_sysfs_mon_statfs_req_set(monc, req, msg); ceph_msg_send(monc->client->msgr, msg, 0); return 0; } @@ -360,6 +360,7 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf) schedule_delayed_work(&monc->statfs_delayed_work, round_jiffies_relative(1*HZ)); monc->num_statfs_requests++; + ceph_sysfs_mon_statfs_req_init(monc, &req); mutex_unlock(&monc->statfs_mutex); /* send request and wait */ diff --git a/src/kernel/super.h b/src/kernel/super.h index 7f5686fa5e9df..6a8699f9e03e2 100644 --- a/src/kernel/super.h +++ b/src/kernel/super.h @@ -805,7 +805,8 @@ extern int ceph_sysfs_mds_req_init(struct ceph_mds_client *mdsc, struct ceph_mds extern void ceph_sysfs_mds_req_cleanup(struct ceph_mds_request *req); extern int ceph_sysfs_osd_req_init(struct ceph_osd_client *osdc, struct ceph_osd_request *req); extern void ceph_sysfs_osd_req_cleanup(struct ceph_osd_request *req); -extern int ceph_sysfs_mon_statfs_req_init(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req, +extern int ceph_sysfs_mon_statfs_req_init(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req); +extern int ceph_sysfs_mon_statfs_req_set(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req, struct ceph_msg *msg); extern void ceph_sysfs_mon_statfs_req_cleanup(struct ceph_mon_statfs_request *req); diff --git a/src/kernel/sysfs.c b/src/kernel/sysfs.c index 089775feb927f..425b6d8b964eb 100644 --- a/src/kernel/sysfs.c +++ b/src/kernel/sysfs.c @@ -368,27 +368,30 @@ static ssize_t req_mon_op_show(struct ceph_mon_statfs_request *req, return sprintf(buf, "statfs\n"); } -int ceph_sysfs_mon_statfs_req_init(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req, - struct ceph_msg *msg) +int ceph_sysfs_mon_statfs_req_init(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req) { int ret = 0; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) ret = kobject_init_and_add(&req->kobj, &ceph_mon_statfs_request_ops, &monc->kobj, "%d", req->tid); - if (ret) - goto out; - - req->k_mon.dst = msg->hdr.dst; +#endif + memset(&req->k_mon.dst, 0, sizeof(req->k_mon.dst)); ADD_ENTITY_ATTR(req, k_mon, "mon", 0400, req_mon_show, NULL); ADD_ENTITY_ATTR(req, k_op, "op", 0400, req_mon_op_show, NULL); - return 0; -out: -#endif return ret; } +int ceph_sysfs_mon_statfs_req_set(struct ceph_mon_client *monc, struct ceph_mon_statfs_request *req, + struct ceph_msg *msg) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) + req->k_mon.dst = msg->hdr.dst; +#endif + return 0; +} + void ceph_sysfs_mon_statfs_req_cleanup(struct ceph_mon_statfs_request *req) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) -- 2.39.5