[Devel] [PATCH RHEL8 COMMIT] ploop: Add check of htable is empty on .dtr

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 17 19:03:21 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.44
------>
commit c4146d999881687bb1d863c6e65a342a4a267417
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jun 17 19:03:21 2021 +0300

    ploop: Add check of htable is empty on .dtr
    
    There mustn't be inflight pios or locks.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Freeze WRITE on -ENOSPC on host
    
    Suspend WRITEs in case of host's fs returns -ENOSPC.
    
    https://jira.sw.ru/browse/PSBM-127225
    
    Kirill Tkhai (5):
          ploop: Add check of htable is empty on .dtr
          ploop: Rename delayed_pios into suspended_pios
          ploop: Remove unused define and comment
          ploop: Close race in ploop_flip_upper_deltas()
          ploop: Freeze on ENOSPC and notify userspace via dm event
    
    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