Skip to contentSkip to conversation

ext4: ext4_xattr_ibody_set() error ignored in ext4_expand_extra_isize_ea()

PATCH In review Roel Kluin 2 participants 2 messages Feb 4, 2010 – Feb 15, 2010 ext4 file system

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 ext4: ext4_xattr_ibody_set() error ignored in ext4_expand_extra_isize_ea()

The error handling was missing.

---
Is this needed?

fs/ext4/xattr.c +2 -0
index f3a2f7e..b77930c 100644
@@ -1302,6 +1302,8 @@ retry:
 
 		/* Remove the chosen entry from the inode */
 		error = ext4_xattr_ibody_set(handle, inode, &i, is);
+		if (error)
+			goto cleanup;
 
 		entry = IFIRST(header);
 		if (entry_size + EXT4_XATTR_SIZE(size) >= new_extra_isize)
#1 lore raw
Quoted 5 lines · Roel Kluin

The error handling was missing.

---
Is this needed?

Yep, it's added, thanks. I'm not entirely right the error handling is completely correct in this function; in particular, if we fail after this point in the function, and we've already changed the status of EXT4_STATE_XATTR flag, but then we fail due to some error (maybe an I/O error), it's not clear the cleanup section is properly unwinding all of the side effects made so far in this function.

Still, adding the error check clearly makes the code better than it was before, so I've added it to the ext4 patch queue.

- Ted