kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 550-ubifs-symlink-xattr-support.patch
1 --- a/fs/ubifs/file.c
2 +++ b/fs/ubifs/file.c
3 @@ -1573,6 +1573,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,
11 };
12
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;
20 + if (xent) {
21 + /*
22 + * Make sure to account for host_ui->data_len in
23 + * length calculation in case there is extended attribute.
24 + */
25 + len += host_ui->data_len;
26 + }
27 dent = kmalloc(len, GFP_NOFS);
28 if (!dent)
29 return -ENOMEM;
30 @@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info *
31
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);
37 if (err)
38 goto out_ro;
39
40 --- a/fs/ubifs/xattr.c
41 +++ b/fs/ubifs/xattr.c
42 @@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
43 goto out_free;
44 }
45 inode->i_size = ui->ui_size = size;
46 - ui->data_len = size;
47
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;
53
54 /*
55 * It is important to write the host inode after the xattr inode