Whamcloud - gitweb
LU-8119 osd: remove dcb entry from the list prior processing. 02/24202/6
authorMikhal Pershin <mike.pershin@intel.com>
Wed, 7 Dec 2016 16:23:03 +0000 (19:23 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Apr 2017 04:43:04 +0000 (04:43 +0000)
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 <mike.pershin@intel.com>
Change-Id: I561add170f408a7d16631424218b2a049d81f4fd
Reviewed-on: https://review.whamcloud.com/24202
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>

index fa04e09..9c09620 100644 (file)
@@ -147,8 +147,13 @@ static void osd_trans_commit_cb(void *cb_data, int error)
        /* 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