[Ocfs2-tools-devel] [PATCH 23/30] dx_dirs: check callback iter->dx_func() return value in dx_iterator()
Mark Fasheh
mfasheh at suse.com
Wed Apr 28 18:26:28 PDT 2010
From: Coly Li <coly.li at suse.de>
This patch makes dx_iterator() check returned value of callback
iter->dx_func(). If an error returned from the callback, dx_iterator()
returns OCFS2_EXTENT_ERROR to stop the iteration.
Thanks to Tao Ma for catching the error.
Signed-off-by: Coly Li <coly.li at suse.de>
Cc: Mark Fasheh <mfasheh at suse.com>
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
libocfs2/dir_iterate.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/libocfs2/dir_iterate.c b/libocfs2/dir_iterate.c
index b21b758..b23ee12 100644
--- a/libocfs2/dir_iterate.c
+++ b/libocfs2/dir_iterate.c
@@ -348,8 +348,13 @@ static int dx_iterator(ocfs2_filesys *fs,
}
dx_leaf = (struct ocfs2_dx_leaf *)iter->leaf_buf;
- iter->dx_func(fs, &dx_leaf->dl_list, iter->dx_root, dx_leaf,
+ err = iter->dx_func(fs, &dx_leaf->dl_list, iter->dx_root, dx_leaf,
iter->dx_priv_data);
+ /* callback dx_func() is defined by users, the return value does not
+ * follow libocfs2 error codes. Don't touch iter->err and just stop
+ * the iteration here.*/
+ if (err)
+ return OCFS2_EXTENT_ERROR;
blkno++;
}
--
1.6.4.2
More information about the Ocfs2-tools-devel
mailing list