From aa64476cef7d5f0050de20839925868013caa0b6 Mon Sep 17 00:00:00 2001 From: Mikhal Pershin Date: Wed, 7 Dec 2016 19:23:03 +0300 Subject: [PATCH] LU-8119 osd: remove dcb entry from the list prior processing. The osd_trans_commit_cb() processes list of commit callbacks but there is list_del_init() missed prior calling dcb_func(). The dcb_func() call frees dcb entry itself, so list head become corrupted. Patch adds this list_del_init(). Signed-off-by: Mikhal Pershin Change-Id: I561add170f408a7d16631424218b2a049d81f4fd Reviewed-on: https://review.whamcloud.com/24202 Reviewed-by: Alex Zhuravlev Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osd-zfs/osd_handler.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index fa04e09..9c09620 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -147,8 +147,13 @@ static void osd_trans_commit_cb(void *cb_data, int 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) + list_for_each_entry_safe(dcb, tmp, &oh->ot_dcb_list, dcb_linkage) { + LASSERTF(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC, + "commit callback entry: magic=%x name='%s'\n", + dcb->dcb_magic, dcb->dcb_name); + list_del_init(&dcb->dcb_linkage); dcb->dcb_func(NULL, th, dcb, error); + } /* Unlike ldiskfs, zfs updates space accounting at commit time. * As a consequence, op_end is called only now to inform the quota slave -- 1.8.3.1