[Ocfs2-tools-devel] [PATCH 3/4] libocfs2: Fix return value of ocfs2_dx_dir_insert.

Tao Ma tao.ma at oracle.com
Tue Sep 21 01:55:37 PDT 2010


ocfs2_dx_dir_insert is used to add the correponding info
to the indexed dir. It has 2 callers by now and these 2
callers have different problems.
1. The callback function used in ocfs2_dir_iterate. In
   case we find an error in this callback, we should set
   OCFS2_DIRENT_ABORT, so that ocfs2_process_dir_entry
   can test it and return immediately.
2. In ocfs2_dx_dir_insert_entry. When we find the return
   value is wrong, the right error is stored in ctxt.err.

So fix these 2 problems.

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

diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index 89f14ee..d0d6d17 100644
--- a/libocfs2/dir_indexed.c
+++ b/libocfs2/dir_indexed.c
@@ -1138,7 +1138,7 @@ insert_into_entries:
 
 set_err:
 	ctxt->err = err;
-	ret = OCFS2_EXTENT_ERROR;
+	ret = OCFS2_DIRENT_ABORT;
 out:
 	if (dx_leaf_buf)
 		ocfs2_free(&dx_leaf_buf);
@@ -1182,6 +1182,8 @@ errcode_t ocfs2_dx_dir_insert_entry(ocfs2_filesys *fs, uint64_t dir, const char
 
 	ret = ocfs2_dx_dir_insert(&dummy_de, blkno, 0,
 			fs->fs_blocksize, NULL, &dummy_ctxt);
+	if (ret)
+		ret = dummy_ctxt.err;
 out:
 	if (di_buf)
 		ocfs2_free(&di_buf);
-- 
1.7.1.GIT




More information about the Ocfs2-tools-devel mailing list