1 ext4: remove checks for e_value_block
3 From: Jan Kara <jack@suse.cz>
5 Currently we don't support xattrs with e_value_block set. We don't allow
6 them to pass initial xattr check so there's no point for checking for
7 this later. Since these tests were untested, bugs were creeping in and
8 not all places which should have checked were checking e_value_block
11 Signed-off-by: Jan Kara <jack@suse.cz>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 fs/ext4/xattr.c | 15 +++++++--------
15 1 file changed, 7 insertions(+), 8 deletions(-)
17 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
18 index f845cb7c6623..1447860b61ec 100644
21 @@ -643,7 +643,7 @@ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last,
22 size_t *min_offs, void *base, int *total)
24 for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
25 - if (!last->e_value_block && last->e_value_size) {
26 + if (last->e_value_size) {
27 size_t offs = le16_to_cpu(last->e_value_offs);
30 @@ -663,7 +663,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
31 /* Compute min_offs and last. */
33 for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
34 - if (!last->e_value_block && last->e_value_size) {
35 + if (last->e_value_size) {
36 size_t offs = le16_to_cpu(last->e_value_offs);
39 @@ -671,7 +671,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
41 free = min_offs - ((void *)last - s->base) - sizeof(__u32);
43 - if (!s->here->e_value_block && s->here->e_value_size) {
44 + if (s->here->e_value_size) {
45 size_t size = le32_to_cpu(s->here->e_value_size);
46 free += EXT4_XATTR_SIZE(size);
48 @@ -693,7 +693,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
49 s->here->e_name_len = name_len;
50 memcpy(s->here->e_name, i->name, name_len);
52 - if (!s->here->e_value_block && s->here->e_value_size) {
53 + if (s->here->e_value_size) {
54 void *first_val = s->base + min_offs;
55 size_t offs = le16_to_cpu(s->here->e_value_offs);
56 void *val = s->base + offs;
57 @@ -727,8 +727,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
59 while (!IS_LAST_ENTRY(last)) {
60 size_t o = le16_to_cpu(last->e_value_offs);
61 - if (!last->e_value_block &&
62 - last->e_value_size && o < offs)
63 + if (last->e_value_size && o < offs)
65 cpu_to_le16(o + size);
66 last = EXT4_XATTR_NEXT(last);
67 @@ -1327,7 +1326,7 @@ static void ext4_xattr_shift_entries(struct ext4_xattr_entry *entry,
69 /* Adjust the value offsets of the entries */
70 for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
71 - if (!last->e_value_block && last->e_value_size) {
72 + if (last->e_value_size) {
73 new_offs = le16_to_cpu(last->e_value_offs) +
75 BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
76 @@ -1726,7 +1725,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
80 - if (entry->e_value_block == 0 && entry->e_value_size != 0) {
81 + if (entry->e_value_size != 0) {
82 __le32 *value = (__le32 *)((char *)header +
83 le16_to_cpu(entry->e_value_offs));
84 for (n = (le32_to_cpu(entry->e_value_size) +