ubifs: remove obsolete CONFIG_UBIFS_FS_XATTR symbol
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.6 / 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 @@ -553,7 +553,8 @@ int ubifs_jnl_update(struct ubifs_info *
17
18 dbg_jnl("ino %lu, dent '%.*s', data len %d in dir ino %lu",
19 inode->i_ino, nm->len, nm->name, ui->data_len, dir->i_ino);
20 - ubifs_assert(dir_ui->data_len == 0);
21 + if (!xent)
22 + ubifs_assert(dir_ui->data_len == 0);
23 ubifs_assert(mutex_is_locked(&dir_ui->ui_mutex));
24
25 dlen = UBIFS_DENT_NODE_SZ + nm->len + 1;
26 @@ -573,6 +574,13 @@ int ubifs_jnl_update(struct ubifs_info *
27 aligned_dlen = ALIGN(dlen, 8);
28 aligned_ilen = ALIGN(ilen, 8);
29 len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
30 + if (xent) {
31 + /*
32 + * Make sure to account for dir_ui->data_len in
33 + * length calculation in case there is extended attribute.
34 + */
35 + len += dir_ui->data_len;
36 + }
37 dent = kmalloc(len, GFP_NOFS);
38 if (!dent)
39 return -ENOMEM;
40 @@ -649,7 +657,8 @@ int ubifs_jnl_update(struct ubifs_info *
41
42 ino_key_init(c, &ino_key, dir->i_ino);
43 ino_offs += aligned_ilen;
44 - err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
45 + err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
46 + UBIFS_INO_NODE_SZ + dir_ui->data_len);
47 if (err)
48 goto out_ro;
49
50 --- a/fs/ubifs/xattr.c
51 +++ b/fs/ubifs/xattr.c
52 @@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
53 goto out_free;
54 }
55 inode->i_size = ui->ui_size = size;
56 - ui->data_len = size;
57
58 mutex_lock(&host_ui->ui_mutex);
59 host->i_ctime = ubifs_current_time(host);
60 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
61 host_ui->xattr_size += CALC_XATTR_BYTES(size);
62 + ui->data_len = size;
63
64 /*
65 * It is important to write the host inode after the xattr inode