From 4b239e9138aa69eb996ee47b31f075c085efa1e5 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 18 Feb 2019 16:10:16 +0300 Subject: [PATCH] LU-9706 dt: remove dt_txn_hook_commit() it's not used and it's not safe as dt_txn_callback_del() and dt_txn_callback_add() can race with commit callbacks. Lustre-change: https://review.whamcloud.com/#/c/34212/ Signed-off-by: Alex Zhuravlev Change-Id: I1744aaa621e28cb3f7e812db5695aa42e8d596cd Reviewed-on: https://review.whamcloud.com/34274 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 2 -- lustre/mdt/mdt_recovery.c | 1 - lustre/obdclass/dt_object.c | 18 ------------------ lustre/osd-ldiskfs/osd_handler.c | 2 -- lustre/osd-zfs/osd_handler.c | 2 -- lustre/target/tgt_main.c | 1 - 6 files changed, 26 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 7d8e702..e872981 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -1919,7 +1919,6 @@ struct dt_txn_callback { struct thandle *txn, void *cookie); int (*dtc_txn_stop)(const struct lu_env *env, struct thandle *txn, void *cookie); - void (*dtc_txn_commit)(struct thandle *txn, void *cookie); void *dtc_cookie; __u32 dtc_tag; struct list_head dtc_linkage; @@ -1931,7 +1930,6 @@ void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb); int dt_txn_hook_start(const struct lu_env *env, struct dt_device *dev, struct thandle *txn); int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn); -void dt_txn_hook_commit(struct thandle *txn); int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj); diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index ed61a2e..b445899 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -103,7 +103,6 @@ int mdt_fs_setup(const struct lu_env *env, struct mdt_device *mdt, /* prepare transactions callbacks */ mdt->mdt_txn_cb.dtc_txn_start = NULL; mdt->mdt_txn_cb.dtc_txn_stop = mdt_txn_stop_cb; - mdt->mdt_txn_cb.dtc_txn_commit = NULL; mdt->mdt_txn_cb.dtc_cookie = NULL; mdt->mdt_txn_cb.dtc_tag = LCT_MD_THREAD; INIT_LIST_HEAD(&mdt->mdt_txn_cb.dtc_linkage); diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index a8f144f..a48e7cb 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -136,24 +136,6 @@ int dt_txn_hook_stop(const struct lu_env *env, struct thandle *th) } EXPORT_SYMBOL(dt_txn_hook_stop); -void dt_txn_hook_commit(struct thandle *th) -{ - struct dt_txn_callback *cb; - - if (th->th_local) - return; - - list_for_each_entry(cb, &th->th_dev->dd_txn_callbacks, - dtc_linkage) { - /* Right now, the bottom device (OSD) will use this hook - * commit to notify OSP, so we do not check and replace - * the thandle to top thandle now */ - if (cb->dtc_txn_commit) - cb->dtc_txn_commit(th, cb->dtc_cookie); - } -} -EXPORT_SYMBOL(dt_txn_hook_commit); - int dt_device_init(struct dt_device *dev, struct lu_device_type *t) { INIT_LIST_HEAD(&dev->dd_txn_callbacks); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 9780d24..1b13df9 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1587,8 +1587,6 @@ static void osd_trans_commit_cb(struct super_block *sb, if (error) CERROR("transaction @0x%p commit error: %d\n", th, error); - dt_txn_hook_commit(th); - /* call per-transaction callbacks if any */ list_for_each_entry_safe(dcb, tmp, &oh->ot_commit_dcb_list, dcb_linkage) { diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index 713ec9b..5f50144 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -148,8 +148,6 @@ static void osd_trans_commit_cb(void *cb_data, int error) osd_dt_dev(th->th_dev)->od_svname, th, error); } - dt_txn_hook_commit(th); - /* call per-transaction callbacks if any */ list_for_each_entry_safe(dcb, tmp, &oh->ot_dcb_list, dcb_linkage) { LASSERTF(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC, diff --git a/lustre/target/tgt_main.c b/lustre/target/tgt_main.c index 4d39237..12f9fdc 100644 --- a/lustre/target/tgt_main.c +++ b/lustre/target/tgt_main.c @@ -218,7 +218,6 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut, /* prepare transactions callbacks */ lut->lut_txn_cb.dtc_txn_start = tgt_txn_start_cb; lut->lut_txn_cb.dtc_txn_stop = tgt_txn_stop_cb; - lut->lut_txn_cb.dtc_txn_commit = NULL; lut->lut_txn_cb.dtc_cookie = lut; lut->lut_txn_cb.dtc_tag = LCT_DT_THREAD | LCT_MD_THREAD; INIT_LIST_HEAD(&lut->lut_txn_cb.dtc_linkage); -- 1.8.3.1