Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-8066 sysfs: make ping sysfs file read and writable
[fs/lustre-release.git]
/
lustre
/
ptlrpc
/
lproc_ptlrpc.c
diff --git
a/lustre/ptlrpc/lproc_ptlrpc.c
b/lustre/ptlrpc/lproc_ptlrpc.c
index
400ce64
..
4e009e0
100644
(file)
--- a/
lustre/ptlrpc/lproc_ptlrpc.c
+++ b/
lustre/ptlrpc/lproc_ptlrpc.c
@@
-109,17
+109,17
@@
static struct ll_rpc_opcode {
{ MGS_TARGET_DEL, "mgs_target_del" },
{ MGS_SET_INFO, "mgs_set_info" },
{ MGS_CONFIG_READ, "mgs_config_read" },
-
{ OBD_PING,
"obd_ping" },
- {
OBD_LOG_CANCEL,
"llog_cancel" },
-
{ OBD_QC_CALLBACK,
"obd_quota_callback" },
- { OBD_IDX_READ, "dt_index_read" },
+
{ OBD_PING,
"obd_ping" },
+ {
401, /* was OBD_LOG_CANCEL */
"llog_cancel" },
+
{ 402, /* was OBD_QC_CALLBACK */
"obd_quota_callback" },
+ { OBD_IDX_READ,
"dt_index_read" },
{ LLOG_ORIGIN_HANDLE_CREATE, "llog_origin_handle_open" },
{ LLOG_ORIGIN_HANDLE_NEXT_BLOCK, "llog_origin_handle_next_block" },
{ LLOG_ORIGIN_HANDLE_READ_HEADER,"llog_origin_handle_read_header" },
- {
LLOG_ORIGIN_HANDLE_WRITE_REC,
"llog_origin_handle_write_rec" },
- {
LLOG_ORIGIN_HANDLE_CLOSE,
"llog_origin_handle_close" },
- {
LLOG_ORIGIN_CONNECT,
"llog_origin_connect" },
- {
LLOG_CATINFO,
"llog_catinfo" },
+ {
504, /*LLOG_ORIGIN_HANDLE_WRITE_REC*/
"llog_origin_handle_write_rec" },
+ {
505, /* was LLOG_ORIGIN_HANDLE_CLOSE */
"llog_origin_handle_close" },
+ {
506, /* was LLOG_ORIGIN_CONNECT */
"llog_origin_connect" },
+ {
507, /* was LLOG_CATINFO */
"llog_catinfo" },
{ LLOG_ORIGIN_HANDLE_PREV_BLOCK, "llog_origin_handle_prev_block" },
{ LLOG_ORIGIN_HANDLE_DESTROY, "llog_origin_handle_destroy" },
{ QUOTA_DQACQ, "quota_acquire" },
@@
-910,10
+910,12
@@
ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos)
if (i > cpt) /* make up the lowest position for this CPT */
*pos = PTLRPC_REQ_CPT2POS(svc, i);
+ mutex_lock(&svcpt->scp_mutex);
spin_lock(&svcpt->scp_lock);
rc = ptlrpc_lprocfs_svc_req_history_seek(svcpt, srhi,
PTLRPC_REQ_POS2SEQ(svc, *pos));
spin_unlock(&svcpt->scp_lock);
+ mutex_unlock(&svcpt->scp_mutex);
if (rc == 0) {
*pos = PTLRPC_REQ_SEQ2POS(svc, srhi->srhi_seq);
srhi->srhi_idx = i;
@@
-955,9
+957,11
@@
ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
seq = srhi->srhi_seq + (1 << svc->srv_cpt_bits);
}
+ mutex_lock(&svcpt->scp_mutex);
spin_lock(&svcpt->scp_lock);
rc = ptlrpc_lprocfs_svc_req_history_seek(svcpt, srhi, seq);
spin_unlock(&svcpt->scp_lock);
+ mutex_unlock(&svcpt->scp_mutex);
if (rc == 0) {
*pos = PTLRPC_REQ_SEQ2POS(svc, srhi->srhi_seq);
srhi->srhi_idx = i;
@@
-1011,6
+1015,7
@@
static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
svcpt = svc->srv_parts[srhi->srhi_idx];
+ mutex_lock(&svcpt->scp_mutex);
spin_lock(&svcpt->scp_lock);
rc = ptlrpc_lprocfs_svc_req_history_seek(svcpt, srhi, srhi->srhi_seq);
@@
-1051,6
+1056,8
@@
static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
}
spin_unlock(&svcpt->scp_lock);
+ mutex_unlock(&svcpt->scp_mutex);
+
return rc;
}
@@
-1302,8
+1309,8
@@
void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
}
EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);
-ssize_t ping_s
tore
(struct kobject *kobj, struct attribute *attr,
-
const char *buffer, size_t count
)
+ssize_t ping_s
how
(struct kobject *kobj, struct attribute *attr,
+
char *buffer
)
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
@@
-1322,36
+1329,17
@@
ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
rc = ptlrpc_queue_wait(req);
ptlrpc_req_finished(req);
- RETURN(rc
>= 0 ? count : rc
);
+ RETURN(rc);
}
-EXPORT_SYMBOL(ping_s
tore
);
+EXPORT_SYMBOL(ping_s
how
);
-ssize_t
-
lprocfs_ping_seq_write(struct file *file, const char __user *buffe
r,
-
size_t count, loff_t *off
)
+/* kept for older verison of tools. */
+
ssize_t ping_store(struct kobject *kobj, struct attribute *att
r,
+
const char *buffer, size_t count
)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ptlrpc_request *req;
- int rc;
- ENTRY;
-
- LPROCFS_CLIMP_CHECK(obd);
- req = ptlrpc_prep_ping(obd->u.cli.cl_import);
- LPROCFS_CLIMP_EXIT(obd);
- if (req == NULL)
- RETURN(-ENOMEM);
-
- req->rq_send_state = LUSTRE_IMP_FULL;
-
- rc = ptlrpc_queue_wait(req);
-
- ptlrpc_req_finished(req);
- if (rc >= 0)
- RETURN(count);
- RETURN(rc);
+ return ping_show(kobj, attr, (char *)buffer);
}
-EXPORT_SYMBOL(
lprocfs_ping_seq_writ
e);
+EXPORT_SYMBOL(
ping_stor
e);
/* 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,
@@
-1390,14
+1378,14
@@
lprocfs_import_seq_write(struct file *file, const char __user *buffer,
uuid = kbuf + prefix_len;
ptr = strstr(uuid, "::");
if (ptr) {
-
__
u32 inst;
-
char *endptr
;
+ u32 inst;
+
int rc
;
*ptr = 0;
do_reconn = 0;
ptr += 2; /* Skip :: */
-
inst = simple_strtol(ptr, &endptr, 10
);
- if (
*endptr
) {
+
rc = kstrtouint(ptr, 10, &inst
);
+ if (
rc
) {
CERROR("config: wrong instance # %s\n", ptr);
} else if (inst != imp->imp_connect_data.ocd_instance) {
CDEBUG(D_INFO, "IR: %s is connecting to an obsoleted "