[Ocfs2-tools-devel] [PATCH 07/10] fsck.ocfs2 now know inline data.

Joel Becker Joel.Becker at oracle.com
Fri Jul 11 18:18:16 PDT 2008


[Patches 8-10 look good ]

On Fri, Jul 11, 2008 at 02:21:00PM +0800, Tao Ma wrote:
> fsck.ocfs2 will only check i_size and i_clusters for inline data.
> As for directory check, inline directory will also be checked.

	You need to check id_count as well.

> @@ -831,9 +850,36 @@ static errcode_t o2fsck_check_blocks(ocfs2_filesys *fs, o2fsck_state *ost,
>  	 * end of the visible cluster end. It is also reasonable for a file
>  	 * which has no allocated blocks but any number of byte sizes,
>  	 * so we don't need to check its size either.
> +	 *
> +	 * In an inline file, i_clusters should be zero and i_size should be
> +	 * less than the max inline data size.
>  	 */
> -	if (OCFS2_RAW_SB(fs->fs_super)->s_feature_incompat &
> -	    OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC) {
> +	if (di->i_dyn_features & OCFS2_INLINE_DATA_FL) {
> +		expected = ocfs2_max_inline_data(fs->fs_blocksize);

	id_count needs to be <= expected, and i_size needs to be <=
id_count.

> +		if (di->i_clusters > 0 &&
> +		    prompt(ost, PY, PR_INODE_CLUSTERS,
> +			   "Inode %"PRIu64" has %"PRIu32" clusters but it has "
> +			   "inline data flag set. "
> +			   "Correct the number of clusters?",
> +			   (uint64_t)di->i_blkno, di->i_clusters)) {
> +			di->i_clusters = 0;
> +			o2fsck_write_inode(ost, blkno, di);
> +		}

	The way you have this working, you trust INLINE_DATA_FL and
truncate clusters.  That is, if you have INLINE_DATA_FL, but i_size is
greater than expected *and* i_clusters != 0, you reduce i_size and clear
i_clusters.  But what if INLINE_DATA_FL is the corruption?  i_size and
i_clusters are correct, and there is really an extent list on there.
The result is an inode with garbage in id_data, and the extents are
returned to the global bitmap.
	I'm not sure what the right answer is here.  Perhaps if *both*
i_size>expected and i_clusters!=0 you then see if i_list looks sane?  If
it's sane, you ask about clearing INLINE_DATA_FL?
	Mark, does this make any sense?

Joel

-- 

"People with narrow minds usually have broad tongues."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list