Skip to contentSkip to conversation

fix the algorithm for addname in xfs_da_node_lookup_int

PATCH In review Kevin Xu 3 participants 4 messages Mar 23, 2008 – Mar 24, 2008 XFS filesystem

lore
Share & tools
lore

Kevin Xu

author
#0 lore raw

PATCH 1/1 fix the algorithm for addname in xfs_da_node_lookup_int

fix the algorithm for addname in xfs_da_node_lookup_int

fs/xfs/xfs_da_btree.c +1 -1
@@ -1161,7 +1161,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *s
 			ASSERT(0);
 			return XFS_ERROR(EFSCORRUPTED);
 		}
-		if (((retval == ENOENT) || (retval == ENOATTR)) &&
+		if ((((retval == ENOENT) && (state->extrablk.index == -1)) || (retval == ENOATTR)) &&
 		    (blk->hashval == args->hashval)) {
 			error = xfs_da_path_shift(state, &state->path, 1, 1,
 							 &retval);
#1 lore raw
Quoted 1 line · Kevin Xu

fix the algorithm for addname in xfs_da_node_lookup_int

Could you please include a bit more of a changelog, i.e. what was broken and how does this fix it? Perhaps a testcase, if there is one?

-Eric

author
#2 lore raw
Quoted 11 lines · Eric Sandeen
Quoted 2 lines · Kevin Xu

fix the algorithm for addname in xfs_da_node_lookup_int

Could you please include a bit more of a changelog, i.e. what was broken and how does this fix it? Perhaps a testcase, if there is one?

-Eric

I think there is a problem in original processing.
When add a new entry and its hash value is already exist in current directory, furthermore the hash value is the last one in a leaf block, although we already found a freespace block for adding the new entry, but we drop this one and continue to check, until the last same hash value.
I think the reason is that xfs_da_node_lookup_int is a common function for addname and lookup.

I added a condition before enter another leaf block, only when we didn't find a freespace block for the new entry, then we need to enter another leaf block.

Regards
Kevin

#3 lore raw
In reply to Kevin Xu
Quoted 1 line · Kevin Xu

fix the algorithm for addname in xfs_da_node_lookup_int

As Eric already asked, please include a complete description of the problem you are fixing, as well as including a "Signed-off-by" line as per Documentation/SubmittingPatches.

What you've indicated may indeed be a bug, but I'd like to see a test case that demonstrates the problem first and that your patch fixes the test case.

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group