aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2017-01-31 14:05:45 -0500
committerTheodore Ts'o <tytso@mit.edu>2017-01-31 14:05:45 -0500
commit47b8941774df6bc134efd6d6051af33391fa3078 (patch)
tree1e91745ba2efe351dc3f7c275e44ec70f6c65ac8 /lib
parent05cecaf49b96ae0c684a4d4fc90c157bad2f2b35 (diff)
downloade2fsprogs-47b8941774df6bc134efd6d6051af33391fa3078.tar.gz
e2fsck: make sure system.data xattr is present
E2fsprogs used to assume that if i_size is less than 60 bytes, the system.data xattr isn't needed (and should be removed). The kernel disagree, and will declare the file system to be corrupted. Enforce the tighter constraints assumed by the kernel. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib')
-rw-r--r--lib/ext2fs/inline_data.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c
index c8613f682..c0fc4ed1d 100644
--- a/lib/ext2fs/inline_data.c
+++ b/lib/ext2fs/inline_data.c
@@ -557,9 +557,6 @@ errcode_t ext2fs_inline_data_set(ext2_filsys fs, ext2_ino_t ino,
}
if (size <= EXT4_MIN_INLINE_DATA_SIZE) {
- retval = ext2fs_inline_data_ea_remove(fs, ino);
- if (retval)
- return retval;
memcpy((void *)inode->i_block, buf, size);
return ext2fs_write_inode(fs, ino, inode);
}
@@ -587,7 +584,10 @@ errcode_t ext2fs_inline_data_set(ext2_filsys fs, ext2_ino_t ino,
return retval;
data.fs = fs;
data.ino = ino;
- data.ea_size = size - EXT4_MIN_INLINE_DATA_SIZE;
+ if (size > EXT4_MIN_INLINE_DATA_SIZE)
+ data.ea_size = size - EXT4_MIN_INLINE_DATA_SIZE;
+ else
+ data.ea_size = 0;
data.ea_data = (char *) buf + EXT4_MIN_INLINE_DATA_SIZE;
return ext2fs_inline_data_ea_set(&data);
}