Whamcloud - gitweb
LU-14838 osc: Remove client contention support 05/44205/5
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 9 Jul 2021 20:13:36 +0000 (16:13 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Jul 2021 02:30:15 +0000 (02:30 +0000)
Lockless buffered i/o and contention detection don't work,
lockless bufferd i/o is unfixable and contention detection
is broken enough that it will have to be rewritten.

Let's remove both.  This patch starts the removal by
pulling the client side support.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: If8583eff176bddb33e197befb967d229f8ca5688
Reviewed-on: https://review.whamcloud.com/44205
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_osc.h
lustre/mdc/lproc_mdc.c
lustre/mdc/mdc_dev.c
lustre/osc/lproc_osc.c
lustre/osc/osc_lock.c
lustre/osc/osc_object.c
lustre/tests/sanityn.sh

index f3ea5f5..7160d92 100644 (file)
@@ -649,7 +649,6 @@ int osc_attr_update(const struct lu_env *env, struct cl_object *obj,
 int osc_object_glimpse(const struct lu_env *env, const struct cl_object *obj,
                       struct ost_lvb *lvb);
 int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc);
-int osc_object_is_contended(struct osc_object *obj);
 int osc_object_find_cbdata(const struct lu_env *env, struct cl_object *obj,
                           ldlm_iterator_t iter, void *data);
 int osc_object_prune(const struct lu_env *env, struct cl_object *obj);
index 19c9511..9dc24aa 100644 (file)
@@ -318,38 +318,6 @@ static ssize_t checksum_dump_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(checksum_dump);
 
-static ssize_t contention_seconds_show(struct kobject *kobj,
-                                      struct attribute *attr,
-                                      char *buf)
-{
-       struct obd_device *obd = container_of(kobj, struct obd_device,
-                                             obd_kset.kobj);
-       struct osc_device *od = obd2osc_dev(obd);
-
-       return sprintf(buf, "%lld\n", od->od_contention_time);
-}
-
-static ssize_t contention_seconds_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 osc_device *od = obd2osc_dev(obd);
-       time64_t val;
-       int rc;
-
-       rc = kstrtoll(buffer, 0, &val);
-       if (rc)
-               return rc;
-
-       od->od_contention_time = val;
-
-       return count;
-}
-LUSTRE_RW_ATTR(contention_seconds);
-
 LUSTRE_ATTR(mds_conn_uuid, 0444, conn_uuid_show, NULL);
 LUSTRE_RO_ATTR(conn_uuid);
 
@@ -651,7 +619,6 @@ static struct attribute *mdc_attrs[] = {
        &lustre_attr_checksum_dump.attr,
        &lustre_attr_max_rpcs_in_flight.attr,
        &lustre_attr_max_mod_rpcs_in_flight.attr,
-       &lustre_attr_contention_seconds.attr,
        &lustre_attr_mds_conn_uuid.attr,
        &lustre_attr_conn_uuid.attr,
        &lustre_attr_ping.attr,
index 970c550..9f45cc6 100644 (file)
@@ -551,18 +551,7 @@ static int mdc_lock_upcall(void *cookie, struct lustre_handle *lockh,
                mdc_lock_granted(env, oscl, lockh);
 
        /* Error handling, some errors are tolerable. */
-       if (oscl->ols_locklessable && rc == -EUSERS) {
-               /* This is a tolerable error, turn this lock into
-                * lockless lock.
-                */
-               osc_object_set_contended(cl2osc(slice->cls_obj));
-               LASSERT(slice->cls_ops != oscl->ols_lockless_ops);
-
-               /* Change this lock to ldlmlock-less lock. */
-               osc_lock_to_lockless(env, oscl, 1);
-               oscl->ols_state = OLS_GRANTED;
-               rc = 0;
-       } else if (oscl->ols_glimpse && rc == -ENAVAIL) {
+       if (oscl->ols_glimpse && rc == -ENAVAIL) {
                LASSERT(oscl->ols_flags & LDLM_FL_LVB_READY);
                mdc_lock_lvb_update(env, cl2osc(slice->cls_obj),
                                    NULL, &oscl->ols_lvb);
@@ -995,8 +984,6 @@ int mdc_lock_init(const struct lu_env *env, struct cl_object *obj,
 
        if (!(enqflags & CEF_MUST))
                osc_lock_to_lockless(env, ols, (enqflags & CEF_NEVER));
-       if (ols->ols_locklessable && !(enqflags & CEF_DISCARD_DATA))
-               ols->ols_flags |= LDLM_FL_DENY_ON_CONTENTION;
 
        if (io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io))
                osc_lock_set_writer(env, io, obj, ols);
index 2f28646..c0fc23e 100644 (file)
@@ -515,38 +515,6 @@ static ssize_t checksum_dump_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(checksum_dump);
 
-static ssize_t contention_seconds_show(struct kobject *kobj,
-                                      struct attribute *attr,
-                                      char *buf)
-{
-       struct obd_device *obd = container_of(kobj, struct obd_device,
-                                             obd_kset.kobj);
-       struct osc_device *od = obd2osc_dev(obd);
-
-       return sprintf(buf, "%lld\n", od->od_contention_time);
-}
-
-static ssize_t contention_seconds_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 osc_device *od = obd2osc_dev(obd);
-       unsigned int val;
-       int rc;
-
-       rc = kstrtouint(buffer, 0, &val);
-       if (rc)
-               return rc;
-
-       od->od_contention_time = val;
-
-       return count;
-}
-LUSTRE_RW_ATTR(contention_seconds);
-
 static ssize_t destroys_in_flight_show(struct kobject *kobj,
                                       struct attribute *attr,
                                       char *buf)
@@ -901,7 +869,6 @@ static struct attribute *osc_attrs[] = {
        &lustre_attr_active.attr,
        &lustre_attr_checksums.attr,
        &lustre_attr_checksum_dump.attr,
-       &lustre_attr_contention_seconds.attr,
        &lustre_attr_cur_dirty_bytes.attr,
        &lustre_attr_cur_lost_grant_bytes.attr,
        &lustre_attr_cur_dirty_grant_bytes.attr,
index 3d73ac8..6b8b460 100644 (file)
@@ -290,18 +290,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,
                osc_lock_granted(env, oscl, lockh);
 
        /* Error handling, some errors are tolerable. */
-       if (oscl->ols_locklessable && rc == -EUSERS) {
-               /* This is a tolerable error, turn this lock into
-                * lockless lock.
-                */
-               osc_object_set_contended(cl2osc(slice->cls_obj));
-               LASSERT(slice->cls_ops != oscl->ols_lockless_ops);
-
-               /* Change this lock to ldlmlock-less lock. */
-               osc_lock_to_lockless(env, oscl, 1);
-               oscl->ols_state = OLS_GRANTED;
-               rc = 0;
-       } else if (oscl->ols_glimpse && rc == -ENAVAIL) {
+       if (oscl->ols_glimpse && rc == -ENAVAIL) {
                LASSERT(oscl->ols_flags & LDLM_FL_LVB_READY);
                osc_lock_lvb_update(env, cl2osc(slice->cls_obj),
                                    NULL, &oscl->ols_lvb);
@@ -822,9 +811,7 @@ void osc_lock_to_lockless(const struct lu_env *env,
                                        (io->ci_lockreq == CILR_MAYBE) &&
                                        (ocd->ocd_connect_flags &
                                         OBD_CONNECT_SRVLOCK);
-               if (io->ci_lockreq == CILR_NEVER ||
-                   /* lockless IO */
-                   (ols->ols_locklessable && osc_object_is_contended(oob))) {
+               if (io->ci_lockreq == CILR_NEVER) {
                        ols->ols_locklessable = 1;
                        slice->cls_ops = ols->ols_lockless_ops;
                }
@@ -1254,8 +1241,6 @@ int osc_lock_init(const struct lu_env *env,
        if (!(enqflags & CEF_MUST))
                /* try to convert this lock to a lockless lock */
                osc_lock_to_lockless(env, oscl, (enqflags & CEF_NEVER));
-       if (oscl->ols_locklessable && !(enqflags & CEF_DISCARD_DATA))
-               oscl->ols_flags |= LDLM_FL_DENY_ON_CONTENTION;
 
        if (io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io))
                osc_lock_set_writer(env, io, obj, oscl);
index 16eab5f..f720946 100644 (file)
@@ -333,28 +333,6 @@ drop_lock:
        RETURN(rc);
 }
 
-int osc_object_is_contended(struct osc_object *obj)
-{
-       struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
-       time64_t osc_contention_time = dev->od_contention_time;
-       ktime_t retry_time;
-
-        if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION))
-                return 1;
-
-        if (!obj->oo_contended)
-                return 0;
-
-       retry_time = ktime_add_ns(obj->oo_contention_time,
-                                 osc_contention_time * NSEC_PER_SEC);
-       if (ktime_after(ktime_get(), retry_time)) {
-               osc_object_clear_contended(obj);
-               return 0;
-       }
-       return 1;
-}
-EXPORT_SYMBOL(osc_object_is_contended);
-
 /**
  * Implementation of struct cl_object_operations::coo_req_attr_set() for osc
  * layer. osc is responsible for struct obdo::o_id and struct obdo::o_seq
index 5498ad3..71af185 100755 (executable)
@@ -917,7 +917,8 @@ test_32b() { # bug 11270
        restore_lustre_params <$p
        rm -f $p
 }
-run_test 32b "lockless i/o"
+# Disable test 32b prior to full removal
+#run_test 32b "lockless i/o"
 
 print_jbd_stat () {
     local dev