2014-10-28 02:14:39 +08:00
|
|
|
--- a/fs/ubifs/file.c
|
|
|
|
+++ b/fs/ubifs/file.c
|
2014-10-28 06:55:39 +08:00
|
|
|
@@ -1573,6 +1573,10 @@ const struct inode_operations ubifs_syml
|
2014-10-28 02:14:39 +08:00
|
|
|
.follow_link = ubifs_follow_link,
|
|
|
|
.setattr = ubifs_setattr,
|
|
|
|
.getattr = ubifs_getattr,
|
|
|
|
+ .setxattr = ubifs_setxattr,
|
|
|
|
+ .getxattr = ubifs_getxattr,
|
|
|
|
+ .listxattr = ubifs_listxattr,
|
|
|
|
+ .removexattr = ubifs_removexattr,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct file_operations ubifs_file_operations = {
|
|
|
|
--- a/fs/ubifs/journal.c
|
|
|
|
+++ b/fs/ubifs/journal.c
|
2014-10-28 06:55:39 +08:00
|
|
|
@@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info *
|
2014-10-28 02:14:39 +08:00
|
|
|
aligned_dlen = ALIGN(dlen, 8);
|
|
|
|
aligned_ilen = ALIGN(ilen, 8);
|
|
|
|
len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
|
|
|
|
+ if (xent) {
|
|
|
|
+ /*
|
2014-10-28 06:55:39 +08:00
|
|
|
+ * Make sure to account for host_ui->data_len in
|
2014-10-28 02:14:39 +08:00
|
|
|
+ * length calculation in case there is extended attribute.
|
|
|
|
+ */
|
2014-10-28 06:55:39 +08:00
|
|
|
+ len += host_ui->data_len;
|
2014-10-28 02:14:39 +08:00
|
|
|
+ }
|
|
|
|
dent = kmalloc(len, GFP_NOFS);
|
|
|
|
if (!dent)
|
|
|
|
return -ENOMEM;
|
2014-10-28 06:55:39 +08:00
|
|
|
@@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info *
|
2014-10-28 02:14:39 +08:00
|
|
|
|
|
|
|
ino_key_init(c, &ino_key, dir->i_ino);
|
|
|
|
ino_offs += aligned_ilen;
|
|
|
|
- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
|
|
|
|
+ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
|
2014-10-28 06:55:39 +08:00
|
|
|
+ UBIFS_INO_NODE_SZ + host_ui->data_len);
|
2014-10-28 02:14:39 +08:00
|
|
|
if (err)
|
|
|
|
goto out_ro;
|
|
|
|
|
|
|
|
--- a/fs/ubifs/xattr.c
|
|
|
|
+++ b/fs/ubifs/xattr.c
|
|
|
|
@@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
|
|
|
|
goto out_free;
|
|
|
|
}
|
|
|
|
inode->i_size = ui->ui_size = size;
|
|
|
|
- ui->data_len = size;
|
|
|
|
|
|
|
|
mutex_lock(&host_ui->ui_mutex);
|
|
|
|
host->i_ctime = ubifs_current_time(host);
|
|
|
|
host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
|
|
|
|
host_ui->xattr_size += CALC_XATTR_BYTES(size);
|
|
|
|
+ ui->data_len = size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It is important to write the host inode after the xattr inode
|