[Ocfs2-tools-devel] [PATCH 2/2] Modify the check in io_cache_disconnect.

Tao Ma tao.ma at oracle.com
Thu Oct 18 23:57:50 PDT 2007


In the io_cache rb-tree, we may want to erase a cached block
which is the root of the whole tree. In this scenario, the rb_parent
will be NULL. So this io_cache will not be removed by the original
io_cache_disconnect and lead to the "assert" problem when we try
io_cache_insert by using the same icb.

Instead, the icb->icb_blkno will be checked when we want to remove
the specified io_cache. The icb->icb_blkno is set to to UINT64_MAX
when it is removed.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 libocfs2/unix_io.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libocfs2/unix_io.c b/libocfs2/unix_io.c
index 65f2791..8a21f17 100644
--- a/libocfs2/unix_io.c
+++ b/libocfs2/unix_io.c
@@ -217,11 +217,12 @@ static void io_cache_disconnect(struct io_cache *ic,
 {
 	/*
 	 * This icb should longer be looked up.
-	 * If rb_parent is NULL, it's already disconnected.
+	 * If icb->icb_blkno is UINT64_MAX, it's already disconnected.
 	 */
-	if (icb->icb_node.rb_parent) {
+	if (icb->icb_blkno != UINT64_MAX) {
 		rb_erase(&icb->icb_node, &ic->ic_lookup);
 		memset(&icb->icb_node, 0, sizeof(struct rb_node));
+		icb->icb_blkno = UINT64_MAX;
 	}
 }
 
-- 
1.5.3.2.g4f337



More information about the Ocfs2-tools-devel mailing list