btrfs-progs: check/original: Add inode mode check
Just like lowmem mode, check inode mode, specially for S_IFMT bits and beyond. Please note that, this check only applies to inodes in fs/subvol trees. It doesn't apply to free space cache inodes. Reported-by: Thorsten Hirsch <t.hirsch@web.de> Signed-off-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
parent
c06c5eef88
commit
23f1e9a13f
|
@ -601,6 +601,9 @@ static void print_inode_error(struct btrfs_root *root, struct inode_record *rec)
|
|||
fprintf(stderr, ", odd inode flags");
|
||||
if (errors & I_ERR_INLINE_RAM_BYTES_WRONG)
|
||||
fprintf(stderr, ", invalid inline ram bytes");
|
||||
if (errors & I_ERR_INVALID_IMODE)
|
||||
fprintf(stderr, ", invalid inode mode bit 0%o",
|
||||
rec->imode & ~07777);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
/* Print the holes if needed */
|
||||
|
@ -793,6 +796,8 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache,
|
|||
if (!rec->checked || rec->merging)
|
||||
return;
|
||||
|
||||
if (!is_valid_imode(rec->imode))
|
||||
rec->errors |= I_ERR_INVALID_IMODE;
|
||||
if (S_ISDIR(rec->imode)) {
|
||||
if (rec->found_size != rec->isize)
|
||||
rec->errors |= I_ERR_DIR_ISIZE_WRONG;
|
||||
|
|
|
@ -184,6 +184,7 @@ struct unaligned_extent_rec_t {
|
|||
#define I_ERR_ODD_INODE_FLAGS (1 << 16)
|
||||
#define I_ERR_INLINE_RAM_BYTES_WRONG (1 << 17)
|
||||
#define I_ERR_MISMATCH_DIR_HASH (1 << 18)
|
||||
#define I_ERR_INVALID_IMODE (1 << 19)
|
||||
|
||||
struct inode_record {
|
||||
struct list_head backrefs;
|
||||
|
|
Loading…
Reference in New Issue