3 @@ -1597,6 +1597,10 @@ const struct inode_operations ubifs_syml
4 .follow_link = ubifs_follow_link,
5 .setattr = ubifs_setattr,
6 .getattr = ubifs_getattr,
7 + .setxattr = ubifs_setxattr,
8 + .getxattr = ubifs_getxattr,
9 + .listxattr = ubifs_listxattr,
10 + .removexattr = ubifs_removexattr,
13 const struct file_operations ubifs_file_operations = {
14 --- a/fs/ubifs/journal.c
15 +++ b/fs/ubifs/journal.c
16 @@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info *
17 aligned_dlen = ALIGN(dlen, 8);
18 aligned_ilen = ALIGN(ilen, 8);
19 len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
22 + * Make sure to account for host_ui->data_len in
23 + * length calculation in case there is extended attribute.
25 + len += host_ui->data_len;
27 dent = kmalloc(len, GFP_NOFS);
30 @@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info *
32 ino_key_init(c, &ino_key, dir->i_ino);
33 ino_offs += aligned_ilen;
34 - err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
35 + err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
36 + UBIFS_INO_NODE_SZ + host_ui->data_len);
40 --- a/fs/ubifs/xattr.c
41 +++ b/fs/ubifs/xattr.c
42 @@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
45 inode->i_size = ui->ui_size = size;
46 - ui->data_len = size;
48 mutex_lock(&host_ui->ui_mutex);
49 host->i_ctime = ubifs_current_time(host);
50 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
51 host_ui->xattr_size += CALC_XATTR_BYTES(size);
52 + ui->data_len = size;
55 * It is important to write the host inode after the xattr inode