1 From: Tahsin Erdogan <tahsin@google.com>
3 ext4: ext4_xattr_delete_inode() should return accurate errors
5 In a few places the function returns without trying to pass the actual
6 error code to the caller. Fix those.
8 Signed-off-by: Tahsin Erdogan <tahsin@google.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 fs/ext4/xattr.c | 16 ++++++++++------
12 1 file changed, 10 insertions(+), 6 deletions(-)
14 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
15 index 0dfae3f8e209..97d33ecf0818 100644
18 @@ -2026,7 +2026,8 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
19 if (!entry->e_value_inum)
21 ea_ino = le32_to_cpu(entry->e_value_inum);
22 - if (ext4_expand_ino_array(lea_ino_array, ea_ino) != 0) {
23 + error = ext4_expand_ino_array(lea_ino_array, ea_ino);
28 @@ -2037,20 +2038,22 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
30 if (!EXT4_I(inode)->i_file_acl) {
31 /* add xattr inode to orphan list */
32 - ext4_xattr_inode_orphan_add(handle, inode, credits,
34 + error = ext4_xattr_inode_orphan_add(handle, inode, credits,
38 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
40 EXT4_ERROR_INODE(inode, "block %llu read error",
41 EXT4_I(inode)->i_file_acl);
45 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) ||
46 BHDR(bh)->h_blocks != cpu_to_le32(1)) {
47 EXT4_ERROR_INODE(inode, "bad block %llu",
48 EXT4_I(inode)->i_file_acl);
49 + error = -EFSCORRUPTED;
53 @@ -2059,7 +2062,8 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
54 if (!entry->e_value_inum)
56 ea_ino = le32_to_cpu(entry->e_value_inum);
57 - if (ext4_expand_ino_array(lea_ino_array, ea_ino) != 0)
58 + error = ext4_expand_ino_array(lea_ino_array, ea_ino);
61 entry->e_value_inum = 0;
63 @@ -2067,7 +2071,7 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
64 /* add xattr inode to orphan list */
65 error = ext4_xattr_inode_orphan_add(handle, inode, credits,
71 if (!IS_NOQUOTA(inode))
72 @@ -2077,7 +2081,7 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
73 error = ext4_journal_extend(handle, credits);
75 error = ext4_journal_restart(handle, credits);
78 ext4_warning(inode->i_sb,
79 "couldn't extend journal (err %d)", error);
82 2.13.1.611.g7e3b11ae1-goog