Re: [PATCH v5 2/2] e2fsck: Correct ext4 dates generated by old kernels.

From: Mark Harris
Date: Thu Nov 14 2013 - 05:15:18 EST


> +/* When today's date is earlier than 2242, we assume that atimes,
> + * ctimes, and mtimes greater than 2242 are actually pre-1970 dates

...mtimes with years in the range 2310..2378 are...

> + * mis-encoded.
> + */
> +#define EXT4_EXTRA_NEGATIVE_DATE_CUTOFF 5 * (1ULL << 32)

Wouldn't 2242 be 0x200000000ULL, i.e. 2 * (1ULL << 32)?


> +
> + /*
> + * If the inode's extended atime (ctime, mtime) is stored in
> + * the old, invalid format, the inode is corrupt.
> + */
> + if (sizeof(time_t) > 4 && ctx->now < EXT4_EXTRA_NEGATIVE_DATE_CUTOFF &&

Needs parentheses (

> + CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, atime) ||
> + CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, ctime) ||
> + CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, mtime)) {

)

> +
> + if (!fix_problem(ctx, PR_1_EA_TIME_OUT_OF_RANGE, pctx))
> + return;
> +
> + inode->i_atime_extra &= ~EXT4_EPOCH_MASK;
> + inode->i_ctime_extra &= ~EXT4_EPOCH_MASK;
> + inode->i_mtime_extra &= ~EXT4_EPOCH_MASK;

With e.g. 2039 atime and 1968 mtime, shouldn't only i_mtime_extra be altered?

> + e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode,
> + EXT2_INODE_SIZE(sb), "pass1");
> + }

- Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/