aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-04-24 18:45:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-04-24 18:45:35 -0400
commitc4b5a614316c505922a522b2e35ba05ea3e08a7c (patch)
tree8b76988940551726ef05d311e02a06bb61464274
parenta9e817425dc0baede8ebe5fbc9984a640257432b (diff)
ext4: Do not try to validate extents on special files
The EXTENTS_FL flag should never be set on special files, but if it is, don't bother trying to validate that the extents tree is valid, since only files, directories, and non-fast symlinks will ever have an extent data structure. We perhaps should flag the filesystem as being corrupted if we see a special file (named pipes, device nodes, Unix domain sockets, etc.) with the EXTENTS_FL flag, but e2fsck doesn't currently check this case, so we'll just ignore this for now, since it's harmless. Without this fix, a special device with the extents flag is flagged as an error by the kernel, so it is impossible to access or delete the inode, but e2fsck doesn't see it as a problem, leading to confused/frustrated users. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/inode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 11460037ea9d..e91f978c7f12 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4407,6 +4407,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4407 (__u64)(le32_to_cpu(raw_inode->i_version_hi)) << 32; 4407 (__u64)(le32_to_cpu(raw_inode->i_version_hi)) << 32;
4408 } 4408 }
4409 4409
4410 ret = 0;
4410 if (ei->i_file_acl && 4411 if (ei->i_file_acl &&
4411 ((ei->i_file_acl < 4412 ((ei->i_file_acl <
4412 (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) + 4413 (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
@@ -4418,8 +4419,11 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4418 ret = -EIO; 4419 ret = -EIO;
4419 goto bad_inode; 4420 goto bad_inode;
4420 } else if (ei->i_flags & EXT4_EXTENTS_FL) { 4421 } else if (ei->i_flags & EXT4_EXTENTS_FL) {
4421 /* Validate extent which is part of inode */ 4422 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
4422 ret = ext4_ext_check_inode(inode); 4423 (S_ISLNK(inode->i_mode) &&
4424 !ext4_inode_is_fast_symlink(inode)))
4425 /* Validate extent which is part of inode */
4426 ret = ext4_ext_check_inode(inode);
4423 } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 4427 } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
4424 (S_ISLNK(inode->i_mode) && 4428 (S_ISLNK(inode->i_mode) &&
4425 !ext4_inode_is_fast_symlink(inode))) { 4429 !ext4_inode_is_fast_symlink(inode))) {