[Devel] [PATCH RH8 1/5] ploop: Add check of htable is empty on .dtr
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Jun 17 18:08:28 MSK 2021
There mustn't be inflight pios or locks.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-target.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 5b2235319f1c..59f4d886b938 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -135,6 +135,17 @@ static bool ploop_has_pending_activity(struct ploop *ploop)
return has;
}
+static bool ploop_empty_htable(struct hlist_head head[])
+{
+ int i;
+
+ for (i = 0; i < PLOOP_HASH_TABLE_SIZE; i++)
+ if (!hlist_empty(&head[i]))
+ return false;
+
+ return true;
+}
+
static void ploop_destroy(struct ploop *ploop)
{
int i;
@@ -151,8 +162,8 @@ static void ploop_destroy(struct ploop *ploop)
if (ploop->deltas[ploop->nr_deltas].file)
fput(ploop->deltas[ploop->nr_deltas].file);
}
-// WARN_ON(!RB_EMPTY_ROOT(&ploop->exclusive_pios));
-// WARN_ON(!RB_EMPTY_ROOT(&ploop->inflight_pios));
+ WARN_ON(!ploop_empty_htable(ploop->exclusive_pios));
+ WARN_ON(!ploop_empty_htable(ploop->inflight_pios));
kfree(ploop->inflight_pios);
kfree(ploop->exclusive_pios);
kfree(ploop->deltas);
More information about the Devel
mailing list