@@ -457,8 +457,10 @@ int lprocfs_wr_uint(struct file *file, const char __user *buffer,
struct adaptive_timeout;
int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at);
int lprocfs_rd_timeouts(struct seq_file *m, void *data);
-int lprocfs_wr_ping(struct file *file, const char __user *buffer,
- size_t count, loff_t *off);
+
+ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
+ char *buffer);
+
int lprocfs_wr_import(struct file *file, const char __user *buffer,
size_t count, loff_t *off);
int lprocfs_rd_pinger_recov(struct seq_file *m, void *n);
@@ -306,6 +306,8 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj,
#define mdc_conn_uuid_show conn_uuid_show
LUSTRE_RO_ATTR(mdc_conn_uuid);
+LUSTRE_RO_ATTR(ping);
+
static ssize_t mdc_rpc_stats_seq_write(struct file *file,
const char __user *buf,
size_t len, loff_t *off)
@@ -454,8 +456,6 @@ static ssize_t mdc_stats_seq_write(struct file *file,
}
LPROC_SEQ_FOPS(mdc_stats);
-LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
-
LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
LPROC_SEQ_FOPS_RO_TYPE(mdc, server_uuid);
LPROC_SEQ_FOPS_RO_TYPE(mdc, timeouts);
@@ -465,8 +465,6 @@ static ssize_t mdc_stats_seq_write(struct file *file,
LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
static struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
- { .name = "ping",
- .fops = &mdc_ping_fops },
{ .name = "connect_flags",
.fops = &mdc_connect_flags_fops },
{ .name = "mds_server_uuid",
@@ -500,6 +498,7 @@ static ssize_t mdc_stats_seq_write(struct file *file,
&lustre_attr_max_mod_rpcs_in_flight.attr,
&lustre_attr_max_pages_per_rpc.attr,
&lustre_attr_mdc_conn_uuid.attr,
+ &lustre_attr_ping.attr,
NULL,
};
@@ -45,8 +45,6 @@
LPROC_SEQ_FOPS_RO_TYPE(mgc, state);
-LPROC_SEQ_FOPS_WR_ONLY(mgc, ping);
-
static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
{
return lprocfs_mgc_rd_ir_state(m, m->private);
@@ -55,8 +53,6 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
LPROC_SEQ_FOPS_RO(mgc_ir_state);
struct lprocfs_vars lprocfs_mgc_obd_vars[] = {
- { .name = "ping",
- .fops = &mgc_ping_fops },
{ .name = "connect_flags",
.fops = &mgc_connect_flags_fops },
{ .name = "mgs_server_uuid",
@@ -73,8 +69,11 @@ struct lprocfs_vars lprocfs_mgc_obd_vars[] = {
#define mgs_conn_uuid_show conn_uuid_show
LUSTRE_RO_ATTR(mgs_conn_uuid);
+LUSTRE_RO_ATTR(ping);
+
static struct attribute *mgc_attrs[] = {
&lustre_attr_mgs_conn_uuid.attr,
+ &lustre_attr_ping.attr,
NULL,
};
@@ -176,6 +176,8 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj,
#define ost_conn_uuid_show conn_uuid_show
LUSTRE_RO_ATTR(ost_conn_uuid);
+LUSTRE_RO_ATTR(ping);
+
static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
@@ -601,14 +603,10 @@ static int osc_unstable_stats_seq_show(struct seq_file *m, void *v)
LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts);
LPROC_SEQ_FOPS_RO_TYPE(osc, state);
-LPROC_SEQ_FOPS_WR_ONLY(osc, ping);
-
LPROC_SEQ_FOPS_RW_TYPE(osc, import);
LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
static struct lprocfs_vars lprocfs_osc_obd_vars[] = {
- { .name = "ping",
- .fops = &osc_ping_fops },
{ .name = "connect_flags",
.fops = &osc_connect_flags_fops },
{ .name = "ost_server_uuid",
@@ -812,6 +810,7 @@ void lproc_osc_attach_seqstat(struct obd_device *dev)
&lustre_attr_short_io_bytes.attr,
&lustre_attr_resend_count.attr,
&lustre_attr_ost_conn_uuid.attr,
+ &lustre_attr_ping.attr,
NULL,
};
@@ -1227,13 +1227,11 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
}
EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);
-#undef BUFLEN
-
-int lprocfs_wr_ping(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
+ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
+ char *buffer)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct ptlrpc_request *req;
int rc;
@@ -1249,13 +1247,13 @@ int lprocfs_wr_ping(struct file *file, const char __user *buffer,
req->rq_send_state = LUSTRE_IMP_FULL;
rc = ptlrpc_queue_wait(req);
-
ptlrpc_req_finished(req);
- if (rc >= 0)
- return count;
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_wr_ping);
+EXPORT_SYMBOL(ping_show);
+
+#undef BUFLEN
/* Write the connection UUID to this file to attempt to connect to that node.
* The connection UUID is a node's primary NID. For example,