Fix up the rest of the inline data code not to complain if there's no
EA, since it's possible that there's no EA because we're in the
process of creating an inline data file. Also, don't return an error
code when removing a nonexistent EA, because there's no reason to.
Furthermore, if we write less than 60 bytes of inline data, remove the
EA to avoid wasting space.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
}
}
- return EXT2_ET_EA_KEY_NOT_FOUND;
+ /* no key found, success! */
+ return 0;
}
errcode_t ext2fs_xattrs_open(ext2_filsys fs, ext2_ino_t ino,
retval = ext2fs_xattr_get(handle, "system.data",
(void **)&data->ea_data, &data->ea_size);
- if (retval)
+ if (retval == EXT2_ET_EA_KEY_NOT_FOUND) {
+ data->ea_size = 0;
+ data->ea_data = NULL;
+ retval = 0;
+ } else if (retval)
goto err;
err:
}
if (size <= EXT4_MIN_INLINE_DATA_SIZE) {
+ retval = ext2fs_inline_data_ea_remove(fs, ino);
+ if (retval)
+ return retval;
memcpy((void *)inode->i_block, buf, size);
return ext2fs_write_inode(fs, ino, inode);
}
ea_rm / user.moo
Exit status is 0
ea_rm / nosuchea
-ea_rm: Extended attribute key not found while removing extended attribute
Exit status is 0
ea_list /
Extended attributes: