Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344901
b: refs/heads/master
c: bd9926e
h: refs/heads/master
i:
  344899: 010e72a
v: v3
  • Loading branch information
Theodore Ts'o committed Dec 11, 2012
1 parent f2137ed commit 8ac2568
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9a4c8019471386c6fb039ae9e30f5216b6b55a9e
refs/heads/master: bd9926e80330d43f15b710c2935fa41b792d56fd
2 changes: 1 addition & 1 deletion trunk/fs/ext4/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int ext4_create_inline_data(handle_t *handle,
goto out;

if (len > EXT4_MIN_INLINE_DATA_SIZE) {
value = (void *)empty_zero_page;
value = EXT4_ZERO_XATTR_VALUE;
len -= EXT4_MIN_INLINE_DATA_SIZE;
} else {
value = "";
Expand Down
22 changes: 16 additions & 6 deletions trunk/fs/ext4/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,14 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
size. Just replace. */
s->here->e_value_size =
cpu_to_le32(i->value_len);
memset(val + size - EXT4_XATTR_PAD, 0,
EXT4_XATTR_PAD); /* Clear pad bytes. */
memcpy(val, i->value, i->value_len);
if (i->value == EXT4_ZERO_XATTR_VALUE) {
memset(val, 0, size);
} else {
/* Clear pad bytes first. */
memset(val + size - EXT4_XATTR_PAD, 0,
EXT4_XATTR_PAD);
memcpy(val, i->value, i->value_len);
}
return 0;
}

Expand Down Expand Up @@ -669,9 +674,14 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
size_t size = EXT4_XATTR_SIZE(i->value_len);
void *val = s->base + min_offs - size;
s->here->e_value_offs = cpu_to_le16(min_offs - size);
memset(val + size - EXT4_XATTR_PAD, 0,
EXT4_XATTR_PAD); /* Clear the pad bytes. */
memcpy(val, i->value, i->value_len);
if (i->value == EXT4_ZERO_XATTR_VALUE) {
memset(val, 0, size);
} else {
/* Clear the pad bytes first. */
memset(val + size - EXT4_XATTR_PAD, 0,
EXT4_XATTR_PAD);
memcpy(val, i->value, i->value_len);
}
}
}
return 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ext4/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct ext4_xattr_entry {
#define BFIRST(bh) ENTRY(BHDR(bh)+1)
#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)

#define EXT4_ZERO_XATTR_VALUE ((void *)-1)

struct ext4_xattr_info {
int name_index;
Expand Down

0 comments on commit 8ac2568

Please sign in to comment.