From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org, Dave Chinner <david@fromorbit.com>,
Jan Kara <jack@suse.cz>
Subject: [PATCH 07/11] ext4: Remove checks for e_value_block
Date: Wed, 3 Aug 2016 12:39:51 +0200 [thread overview]
Message-ID: <1470220795-17045-8-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1470220795-17045-1-git-send-email-jack@suse.cz>
Currently we don't support xattrs with e_value_block set. We don't allow
them to pass initial xattr check so there's no point for checking for
this later. Since these tests were untested, bugs were creeping in and
not all places which should have checked were checking e_value_block
anyway.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/xattr.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index f845cb7c6623..1447860b61ec 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -643,7 +643,7 @@ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last,
size_t *min_offs, void *base, int *total)
{
for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
- if (!last->e_value_block && last->e_value_size) {
+ if (last->e_value_size) {
size_t offs = le16_to_cpu(last->e_value_offs);
if (offs < *min_offs)
*min_offs = offs;
@@ -663,7 +663,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
/* Compute min_offs and last. */
last = s->first;
for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
- if (!last->e_value_block && last->e_value_size) {
+ if (last->e_value_size) {
size_t offs = le16_to_cpu(last->e_value_offs);
if (offs < min_offs)
min_offs = offs;
@@ -671,7 +671,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
}
free = min_offs - ((void *)last - s->base) - sizeof(__u32);
if (!s->not_found) {
- if (!s->here->e_value_block && s->here->e_value_size) {
+ if (s->here->e_value_size) {
size_t size = le32_to_cpu(s->here->e_value_size);
free += EXT4_XATTR_SIZE(size);
}
@@ -693,7 +693,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
s->here->e_name_len = name_len;
memcpy(s->here->e_name, i->name, name_len);
} else {
- if (!s->here->e_value_block && s->here->e_value_size) {
+ if (s->here->e_value_size) {
void *first_val = s->base + min_offs;
size_t offs = le16_to_cpu(s->here->e_value_offs);
void *val = s->base + offs;
@@ -727,8 +727,7 @@ ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
last = s->first;
while (!IS_LAST_ENTRY(last)) {
size_t o = le16_to_cpu(last->e_value_offs);
- if (!last->e_value_block &&
- last->e_value_size && o < offs)
+ if (last->e_value_size && o < offs)
last->e_value_offs =
cpu_to_le16(o + size);
last = EXT4_XATTR_NEXT(last);
@@ -1327,7 +1326,7 @@ static void ext4_xattr_shift_entries(struct ext4_xattr_entry *entry,
/* Adjust the value offsets of the entries */
for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
- if (!last->e_value_block && last->e_value_size) {
+ if (last->e_value_size) {
new_offs = le16_to_cpu(last->e_value_offs) +
value_offs_shift;
BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
@@ -1726,7 +1725,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
*name++;
}
- if (entry->e_value_block == 0 && entry->e_value_size != 0) {
+ if (entry->e_value_size != 0) {
__le32 *value = (__le32 *)((char *)header +
le16_to_cpu(entry->e_value_offs));
for (n = (le32_to_cpu(entry->e_value_size) +
--
2.6.6
next prev parent reply other threads:[~2016-08-03 10:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-03 10:39 [PATCH 0/11] ext4: Fix inode expansion code Jan Kara
2016-08-03 10:39 ` [PATCH 01/11] ext4: Fix xattr shifting when expanding inodes Jan Kara
2016-08-03 23:25 ` Andreas Dilger
2016-08-04 8:43 ` Jan Kara
2016-08-11 17:32 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 02/11] ext4: Fix xattr shifting when expanding inodes (2) Jan Kara
2016-08-11 17:32 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 03/11] ext4: Properly align shifted xattrs when expanding inodes Jan Kara
2016-08-11 17:32 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 04/11] ext4: Avoid deadlock when expanding inode size Jan Kara
2016-08-11 17:32 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 05/11] ext4: Fixup free space calculations when expanding inodes Jan Kara
2016-08-11 17:33 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 06/11] ext4: Check that external xattr value block is 0 Jan Kara
2016-08-11 17:33 ` Theodore Ts'o
2016-08-03 10:39 ` Jan Kara [this message]
2016-08-11 17:33 ` [PATCH 07/11] ext4: Remove checks for e_value_block Theodore Ts'o
2016-08-03 10:39 ` [PATCH 08/11] ext4: Replace bogus assertion in ext4_xattr_shift_entries() Jan Kara
2016-08-11 17:33 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 09/11] ext4: Factor out xattr moving Jan Kara
2016-08-11 17:33 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 10/11] ext4: Remove (almost) unused variables from ext4_expand_extra_isize_ea() Jan Kara
2016-08-11 17:34 ` Theodore Ts'o
2016-08-03 10:39 ` [PATCH 11/11] ext4: Factor out loop for freeing inode xattr space Jan Kara
2016-08-11 17:34 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470220795-17045-8-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=david@fromorbit.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).