public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] e2fsprogs: dblist iteration loop is unbreakable
@ 2007-09-22  0:24 Vladimir V. Saveliev
  2007-09-23 15:40 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir V. Saveliev @ 2007-09-22  0:24 UTC (permalink / raw)
  To: ext4

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: break-dblist-loop.patch --]
[-- Type: text/x-patch, Size: 1007 bytes --]


ext2fs_dblist_iterate breaks its iteration loop if callback's return value
has set DBLIST_ABORT bit.
If ext2fs_dblist_iterate is called by ext2fs_dblist_dir_iterate,
the callback is db_dir_proc->ext2fs_process_dir_block, which returns BLOCK_ABORT
if something goes wrong.
BLOCK_ABORT is defined as 2, whereas DBLIST_ABORT is 1.
As result ext2fs_dblist_iterate does not break the iteration loop when
ext2fs_process_dir_block returns BLOCK_ABORT.



diff -puN lib/ext2fs/dblist.c~break-dblist-loop lib/ext2fs/dblist.c
--- e2fsprogs-1.40.2/lib/ext2fs/dblist.c~break-dblist-loop	2007-09-22 03:13:22.000000000 +0300
+++ e2fsprogs-1.40.2-plodder/lib/ext2fs/dblist.c	2007-09-22 03:13:22.000000000 +0300
@@ -232,7 +232,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dbl
 		ext2fs_dblist_sort(dblist, 0);
 	for (i=0; i < dblist->count; i++) {
 		ret = (*func)(dblist->fs, &dblist->list[(int)i], priv_data);
-		if (ret & DBLIST_ABORT)
+		if ((ret & DBLIST_ABORT) || (ret == BLOCK_ABORT))
 			return 0;
 	}
 	return 0;

_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-23 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22  0:24 [RFC] [PATCH] e2fsprogs: dblist iteration loop is unbreakable Vladimir V. Saveliev
2007-09-23 15:40 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox