forked from Mirrors/btrfs-progs
btrfs-progs: check: check symlinks with append/immutable flags
Define new macro I_ERR_ODD_INODE_FLAGS to represents odd inode flags. Symlinks should never have append/immutable flags. While processing inodes, if found a symlink with append/immutable flags, mark the inode record with I_ERR_ODD_INODE_FLAGS. This is for original mode. Issue: #133 Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>master
parent
723cab8a72
commit
eef9f3eed6
|
@ -576,6 +576,8 @@ static void print_inode_error(struct btrfs_root *root, struct inode_record *rec)
|
|||
fprintf(stderr, ", link count wrong");
|
||||
if (errors & I_ERR_FILE_EXTENT_ORPHAN)
|
||||
fprintf(stderr, ", orphan file extent");
|
||||
if (errors & I_ERR_ODD_INODE_FLAGS)
|
||||
fprintf(stderr, ", odd inode flags");
|
||||
fprintf(stderr, "\n");
|
||||
/* Print the orphan extents if needed */
|
||||
if (errors & I_ERR_FILE_EXTENT_ORPHAN)
|
||||
|
@ -805,6 +807,7 @@ static int process_inode_item(struct extent_buffer *eb,
|
|||
{
|
||||
struct inode_record *rec;
|
||||
struct btrfs_inode_item *item;
|
||||
u64 flags;
|
||||
|
||||
rec = active_node->current;
|
||||
BUG_ON(rec->ino != key->objectid || rec->refs > 1);
|
||||
|
@ -822,6 +825,10 @@ static int process_inode_item(struct extent_buffer *eb,
|
|||
rec->found_inode_item = 1;
|
||||
if (rec->nlink == 0)
|
||||
rec->errors |= I_ERR_NO_ORPHAN_ITEM;
|
||||
flags = btrfs_inode_flags(eb, item);
|
||||
if (S_ISLNK(rec->imode) &&
|
||||
flags & (BTRFS_INODE_IMMUTABLE | BTRFS_INODE_APPEND))
|
||||
rec->errors |= I_ERR_ODD_INODE_FLAGS;
|
||||
maybe_free_inode_rec(&active_node->inode_cache, rec);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@ struct file_extent_hole {
|
|||
#define I_ERR_LINK_COUNT_WRONG (1 << 13)
|
||||
#define I_ERR_FILE_EXTENT_ORPHAN (1 << 14)
|
||||
#define I_ERR_FILE_EXTENT_TOO_LARGE (1 << 15)
|
||||
#define I_ERR_ODD_INODE_FLAGS (1 << 16)
|
||||
|
||||
struct inode_record {
|
||||
struct list_head backrefs;
|
||||
|
|
Loading…
Reference in New Issue