[Ocfs2-tools-devel] [PATCH 07/10] fsck.ocfs2 now know inline data.
Tao Ma
tao.ma at oracle.com
Fri Jul 18 02:02:09 PDT 2008
Hi joel,
Joel Becker wrote:
>> + 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?
You suggestion make me to think more of it. So how should we trust this
flag? As you have said, yes, there is a possibility that the
INLINE_DATA_FL is happened to be the corruption, then there is also one
possibility that ~INLINE_DATA_FL is also the corruption, what should we
handle this also?
So now my thought is that take INLINE_DATA_FL, i_size, i_clusters as one
compound judgement. So if the 2 things happens to be right, we will
regard them as right.
1) if INLINE_DATA_FL is set:
a) if either i_size <= max_inline_data or i_clusters=0, we trust
this flag and clear the error i_size or i_clusters.
b) if both i_size > max_inline_data and i_clusters>0, clear the flag
and go on with check_el. The only problem is how should we handle the
error in check_el(any error in check_el will not make us reset
INLINE_DATA_FL or if there is any error, we will trust INLINE_DATA_FL
and set it back?).
2) if INLINE_DATA_FL isn't set:
a) if both i_size <= max_inline_data and i_clusters=0, we set this
flag.
b) if either i_size > max_inline_data or i_clusters>0, we trust the
file isn't inline. so go with check_el.
Does it make sense? Mark, do you have any suggestion about this?
Regards,
Tao
More information about the Ocfs2-tools-devel
mailing list