]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix statfs sysfs entries init/cleanup
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 17 Mar 2009 18:09:18 +0000 (11:09 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 17 Mar 2009 18:09:18 +0000 (11:09 -0700)
src/kernel/mon_client.c
src/kernel/super.h
src/kernel/sysfs.c

index a2431603635390571d4baf1eb156deb31aca2527..5a33a5f0d793d5fd04e867167d046897158a9bcb 100644 (file)
@@ -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 */
index 7f5686fa5e9df6a5af722547d1e097fd609e87d2..6a8699f9e03e2a33c0032cad215bf8cb0b1d5c84 100644 (file)
@@ -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);
 
index 089775feb927fc9982b27da976b8d1457f522d5b..425b6d8b964eb4bc6ec7787dbf853c7d7f45eae3 100644 (file)
@@ -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)