From: John L. Hammond Date: Tue, 21 Sep 2021 18:39:56 +0000 (-0500) Subject: EX-3875 lustre: add allow_intr param to mdc and osc X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b7d3887436fd5204afe2afce79de6d48eaa0bf54;p=fs%2Flustre-release.git EX-3875 lustre: add allow_intr param to mdc and osc Add an obd_import parameter ("allow_intr") to make all requests from a given import interruptible. Remove hot-pools test_16() from ALWAYS_EXCEPT. Remove the unconditional setting of allow_intr added by EX-3749 mdc: non blocking close and changelog release. Lustre-change: https://review.whamcloud.com/45005 Lustre-commit: c5803ee670b57d05568f4c0ef527be6977772540 Test-Parameters: trivial testlist=hot-pools env=ONLY=16,ONLY_REPEAT=20 Change-Id: Ibc258a0e89dab204f2a10ba29e3eea19030ad444 Signed-off-by: John L. Hammond Reviewed-on: https://review.whamcloud.com/45129 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index c0e6f67..0307933 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -588,6 +588,11 @@ extern ssize_t lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off); #endif +ssize_t allow_intr_show(struct kobject *kobj, struct attribute *attr, + char *buf); +ssize_t allow_intr_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count); + ssize_t ping_store(struct kobject *kobj, struct attribute *attr, const char *buffer, size_t count); ssize_t ping_show(struct kobject *kobj, struct attribute *attr, diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index c4760d9..3090078 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -321,7 +321,9 @@ struct obd_import { /* grant shrink disabled */ imp_grant_shrink_disabled:1, /* to supress LCONSOLE() at conn.restore */ - imp_was_idle:1; + imp_was_idle:1, + /* set rq_allow_intr on all requests for this import */ + imp_allow_intr:1; u32 imp_connect_op; u32 imp_idle_timeout; u32 imp_idle_debug; diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index c056c3b..518830d 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -75,6 +75,8 @@ static ssize_t active_store(struct kobject *kobj, struct attribute *attr, } LUSTRE_RW_ATTR(active); +LUSTRE_RW_ATTR(allow_intr); + static ssize_t max_rpcs_in_flight_show(struct kobject *kobj, struct attribute *attr, char *buf) @@ -611,6 +613,7 @@ struct lprocfs_vars lprocfs_mdc_obd_vars[] = { static struct attribute *mdc_attrs[] = { &lustre_attr_active.attr, + &lustre_attr_allow_intr.attr, &lustre_attr_checksums.attr, &lustre_attr_checksum_dump.attr, &lustre_attr_max_rpcs_in_flight.attr, diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index b034fec..d47e747 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -922,8 +922,6 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, GOTO(out, rc = -ENOMEM); } - req->rq_allow_intr = 1; - if (u32_count > 0) req_capsule_set_size(&req->rq_pill, &RMF_U32, RCL_CLIENT, u32_count * sizeof(__u32)); diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index f81853f..741fbdf 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -78,6 +78,8 @@ static ssize_t active_store(struct kobject *kobj, struct attribute *attr, } LUSTRE_RW_ATTR(active); +LUSTRE_RW_ATTR(allow_intr); + static ssize_t max_rpcs_in_flight_show(struct kobject *kobj, struct attribute *attr, char *buf) @@ -862,6 +864,7 @@ int lprocfs_osc_attach_seqstat(struct obd_device *obd) static struct attribute *osc_attrs[] = { &lustre_attr_active.attr, + &lustre_attr_allow_intr.attr, &lustre_attr_checksums.attr, &lustre_attr_checksum_dump.attr, &lustre_attr_cur_dirty_bytes.attr, diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 254c648..4f96d83 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -974,6 +974,9 @@ ptlrpc_request_alloc_internal(struct obd_import *imp, } } + if (imp->imp_allow_intr) + request->rq_allow_intr = 1; + req_capsule_init(&request->rq_pill, request, RCL_CLIENT); req_capsule_set(&request->rq_pill, format); return request; diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c index 57aa4b2..fa9782e 100644 --- a/lustre/ptlrpc/llog_client.c +++ b/lustre/ptlrpc/llog_client.c @@ -98,8 +98,6 @@ static int llog_client_open(const struct lu_env *env, if (!req) GOTO(out, rc = -ENOMEM); - req->rq_allow_intr = 1; - if (name) req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, strlen(name) + 1); @@ -166,8 +164,6 @@ static int llog_client_next_block(const struct lu_env *env, if (!req) GOTO(err_exit, rc = -ENOMEM); - req->rq_allow_intr = 1; - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1; @@ -240,8 +236,6 @@ static int llog_client_prev_block(const struct lu_env *env, if (!req) GOTO(err_exit, rc = -ENOMEM); - req->rq_allow_intr = 1; - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1; @@ -293,8 +287,6 @@ static int llog_client_read_header(const struct lu_env *env, if (!req) GOTO(err_exit, rc = -ENOMEM); - req->rq_allow_intr = 1; - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = handle->lgh_id; body->lgd_ctxt_idx = handle->lgh_ctxt->loc_idx - 1; diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 9904bcf..04a4142 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1301,6 +1301,41 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) } EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); +ssize_t allow_intr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kset.kobj); + struct obd_import *imp; + ssize_t rc; + + with_imp_locked(obd, imp, rc) + rc = snprintf(buf, PAGE_SIZE, "%d\n", (int)imp->imp_allow_intr); + + return rc; +} +EXPORT_SYMBOL(allow_intr_show); + +ssize_t allow_intr_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count) +{ + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kset.kobj); + struct obd_import *imp; + bool val; + int rc; + + rc = kstrtobool(buffer, &val); + if (rc) + return rc; + + with_imp_locked(obd, imp, rc) + imp->imp_allow_intr = val; + + return count; +} +EXPORT_SYMBOL(allow_intr_store); + ssize_t ping_show(struct kobject *kobj, struct attribute *attr, char *buffer) { diff --git a/lustre/tests/hot-pools.sh b/lustre/tests/hot-pools.sh index 3d831b9..82d696e 100755 --- a/lustre/tests/hot-pools.sh +++ b/lustre/tests/hot-pools.sh @@ -1538,6 +1538,8 @@ test_16() { facet=${LAMIGO_MDT_FACET[0]} pid_file=${LAMIGO_PIDFILE[0]} + do_facet $facet lctl set_param "mdc.*.allow_intr=1" "osc.*.allow_intr=1" + start_one_lamigo_cmd start_pid=$! echo "start_pid = '${start_pid}'" >&2 @@ -1545,7 +1547,12 @@ test_16() { check_one_lamigo_is_started || error "failed to start lamigo" stop $facet - do_facet $facet "pkill --pidfile=${pid_file} lamigo" + + # XXX Double kill needed to interrupt close RPCs from do_exit(). + # XXX This doesn't work when -TERM is used in both pkills. + do_facet $facet "pkill -TERM --pidfile=${pid_file} lamigo" + sleep 10 + do_facet $facet "pkill -KILL --pidfile=${pid_file} lamigo" wait ${start_pid} status=$?