[Ocfs2-tools-devel] [PATCH 7/9] ocfs2-tools: add xattr support in fsck.ocfs2

Tiger Yang tiger.yang at oracle.com
Sun Feb 1 23:57:51 PST 2009


Joel Becker wrote:
>> +	while (!IS_LAST_ENTRY(entry)) {
>> +		count++;
>> +		entry++;
>> +	}
> 
> 	Can the IS_LAST_ENTRY loop walk off the end of the header?  I
> think it can.  If the object (inode, block, bucket) is full, the last
> xattr_entry runs right up against the first name, right?  I think you
> have to keep track of where the values are.  That is, if
> ((char *)entry - (char *)header) > previous_entry->xe_name_offset),
> you've walked past the place where entries crosses into the values.
> 	Not only that, but whether you detect the end by IS_LAST_ENTRY()
> or via the check I just described, you can then use
> previous_entry->xe_name_offset to validate xh_free_start (shouldn't it
> equal previous_entry->xe_name_offset?).  Once you're sure about
> xh_free_start, the calling functions can check xe_name_value_len against
> the size of xattr space in the inode/block/bucket.  Tao, do you agree
> with this?

Let me explain the situation.
EAs in ibody/block are little different from them in bucket.
First, there is at least 4 bytes blank space between xattr_entry and 
name+value when EAs in ibody/block. we reserved it before set_entry.
free = min_offs - ((void *)last - xs->base) - sizeof(__u32);
but in bucket, you are right, they could match.
Second, we didn't set xh_free_start when EAs in ibody/block, for only 
few EAs could be set in here. xh_free_start and xe_name_value_len only 
be set when EAs in bucket.

I will take your advice for checking EAs in bucket and modify my current 
checking method when EAs in ibody/block.

I will fix other problems follow your comments, thanks.

Thanks,
tiger



More information about the Ocfs2-tools-devel mailing list