From a21ce928aa641cbfacb9dde74e4be1cd1b658fb0 Mon Sep 17 00:00:00 2001 From: Andrew Perepechko Date: Sun, 24 Apr 2022 17:48:09 +0300 Subject: [PATCH] LU-15894 ofd: revert range locking in ofd After commit 301d76a711 (LU-14876), range locking is no longer needed in ofd, because 301d76a711 itself prevents the original data corruption fixed by range locking. At the same time, range locking in ofd adds unnecessary overhead, we can even see serialization under specific load. This patch reverts range locking but keeps recovery-small test 148 to test the original corruption scenario case. Change-Id: Ic795bcfb1e249c4927f66b6bad456f5511819861 Signed-off-by: Andrew Perepechko HPE-bug-id: LUS-9890 Fixes: 35679a730 ("LU-10958 ofd: data corruption due to RPC reordering") Reviewed-on: https://review.whamcloud.com/47466 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alexander Zarochentsev Reviewed-by: Alexander Boyko Reviewed-by: Oleg Drokin --- lustre/ofd/ofd_dev.c | 1 - lustre/ofd/ofd_internal.h | 4 ---- lustre/ofd/ofd_io.c | 26 -------------------------- 3 files changed, 31 deletions(-) diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index c9bcd40..0c43df0 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -544,7 +544,6 @@ static struct lu_object *ofd_object_alloc(const struct lu_env *env, lu_object_init(o, h, d); lu_object_add_top(h, o); o->lo_ops = &ofd_obj_ops; - range_lock_tree_init(&of->ofo_write_tree); RETURN(o); } else { RETURN(NULL); diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index cb2280e..f3f4de7 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -37,7 +37,6 @@ #include #include #include -#include #define OFD_INIT_OBJID 0 #define OFD_PRECREATE_BATCH_DEFAULT (OBJ_SUBDIR_COUNT * 4) @@ -188,7 +187,6 @@ struct ofd_object { time64_t ofo_atime_ondisk; unsigned int ofo_pfid_checking:1, ofo_pfid_verified:1; - struct range_lock_tree ofo_write_tree; }; static inline struct ofd_object *ofd_obj(struct lu_object *o) @@ -287,8 +285,6 @@ struct ofd_thread_info { struct lfsck_req_local fti_lrl; struct obd_connect_data fti_ocd; }; - struct range_lock fti_write_range; - unsigned fti_range_locked:1; }; extern void target_recovery_fini(struct obd_device *obd); diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index e6c8991..8b79362 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -689,7 +689,6 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, enum dt_bufs_type dbt = DT_BUFS_TYPE_WRITE; int maxlnb = *nr_local; __u64 begin, end; - struct range_lock *range = &ofd_info(env)->fti_write_range; ENTRY; LASSERT(env != NULL); @@ -842,26 +841,6 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, obj->ioo_bufcnt, WRITE); - /* - * Reordering precautions: make sure that request processing that - * was able to receive its bulk data should not get reordered with - * overlapping BRW requests, e.g. - * 1) BRW1 sent, bulk data received, but disk I/O delayed - * 2) BRW1 resent and fully processed - * 3) the page was unlocked on the client and its writeback bit reset - * 4) BRW2 sent and fully processed - * 5) BRW1 processing wakes up and writes stale data to disk - * If on step 1 bulk data was not received, client resend will invalidate - * its bulk descriptor and the RPC will be dropped due to failed bulk - * transfer, which is just fine. - */ - range_lock_init(range, - rnb[0].rnb_offset, - rnb[obj->ioo_bufcnt - 1].rnb_offset + - rnb[obj->ioo_bufcnt - 1].rnb_len - 1); - range_lock(&fo->ofo_write_tree, range); - ofd_info(env)->fti_range_locked = 1; - RETURN(0); err: @@ -1234,7 +1213,6 @@ ofd_commitrw_write(const struct lu_env *env, struct obd_export *exp, bool soft_sync = false; bool cb_registered = false; bool fake_write = false; - struct range_lock *range = &ofd_info(env)->fti_write_range; ENTRY; @@ -1399,10 +1377,6 @@ out_stop: dt_commit_async(env, ofd->ofd_osd); out: - if (info->fti_range_locked) { - range_unlock(&fo->ofo_write_tree, range); - info->fti_range_locked = 0; - } dt_bufs_put(env, o, lnb, niocount); ofd_object_put(env, fo); if (granted > 0) -- 1.8.3.1