Whamcloud - gitweb
EX-3875 lustre: add allow_intr param to mdc and osc
authorJohn L. Hammond <jhammond@whamcloud.com>
Tue, 21 Sep 2021 18:39:56 +0000 (13:39 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 10 Oct 2021 22:01:50 +0000 (22:01 +0000)
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 <jhammond@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45129
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/include/lustre_import.h
lustre/mdc/lproc_mdc.c
lustre/mdc/mdc_request.c
lustre/osc/lproc_osc.c
lustre/ptlrpc/client.c
lustre/ptlrpc/llog_client.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/tests/hot-pools.sh

index c0e6f67..0307933 100644 (file)
@@ -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,
index c4760d9..3090078 100644 (file)
@@ -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;
index c056c3b..518830d 100644 (file)
@@ -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,
index b034fec..d47e747 100644 (file)
@@ -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));
index f81853f..741fbdf 100644 (file)
@@ -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,
index 254c648..4f96d83 100644 (file)
@@ -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;
index 57aa4b2..fa9782e 100644 (file)
@@ -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;
index 9904bcf..04a4142 100644 (file)
@@ -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)
 {
index 3d831b9..82d696e 100755 (executable)
@@ -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=$?