ramips: add support for unbranded XDX-RN502J board
[openwrt.git] / target / linux / generic / patches-3.3 / 550-ubifs-symlink-xattr-support.patch
1 --- a/fs/ubifs/file.c
2 +++ b/fs/ubifs/file.c
3 @@ -1575,6 +1575,12 @@ const struct inode_operations ubifs_syml
4 .follow_link = ubifs_follow_link,
5 .setattr = ubifs_setattr,
6 .getattr = ubifs_getattr,
7 +#ifdef CONFIG_UBIFS_FS_XATTR
8 + .setxattr = ubifs_setxattr,
9 + .getxattr = ubifs_getxattr,
10 + .listxattr = ubifs_listxattr,
11 + .removexattr = ubifs_removexattr,
12 +#endif
13 };
14
15 const struct file_operations ubifs_file_operations = {
16 --- a/fs/ubifs/journal.c
17 +++ b/fs/ubifs/journal.c
18 @@ -553,7 +553,8 @@ int ubifs_jnl_update(struct ubifs_info *
19
20 dbg_jnl("ino %lu, dent '%.*s', data len %d in dir ino %lu",
21 inode->i_ino, nm->len, nm->name, ui->data_len, dir->i_ino);
22 - ubifs_assert(dir_ui->data_len == 0);
23 + if (!xent)
24 + ubifs_assert(dir_ui->data_len == 0);
25 ubifs_assert(mutex_is_locked(&dir_ui->ui_mutex));
26
27 dlen = UBIFS_DENT_NODE_SZ + nm->len + 1;
28 @@ -573,6 +574,13 @@ int ubifs_jnl_update(struct ubifs_info *
29 aligned_dlen = ALIGN(dlen, 8);
30 aligned_ilen = ALIGN(ilen, 8);
31 len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
32 + if (xent) {
33 + /*
34 + * Make sure to account for dir_ui->data_len in
35 + * length calculation in case there is extended attribute.
36 + */
37 + len += dir_ui->data_len;
38 + }
39 dent = kmalloc(len, GFP_NOFS);
40 if (!dent)
41 return -ENOMEM;
42 @@ -649,7 +657,8 @@ int ubifs_jnl_update(struct ubifs_info *
43
44 ino_key_init(c, &ino_key, dir->i_ino);
45 ino_offs += aligned_ilen;
46 - err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
47 + err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
48 + UBIFS_INO_NODE_SZ + dir_ui->data_len);
49 if (err)
50 goto out_ro;
51
52 --- a/fs/ubifs/xattr.c
53 +++ b/fs/ubifs/xattr.c
54 @@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
55 goto out_free;
56 }
57 inode->i_size = ui->ui_size = size;
58 - ui->data_len = size;
59
60 mutex_lock(&host_ui->ui_mutex);
61 host->i_ctime = ubifs_current_time(host);
62 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
63 host_ui->xattr_size += CALC_XATTR_BYTES(size);
64 + ui->data_len = size;
65
66 /*
67 * It is important to write the host inode after the xattr inode
This page took 0.052126 seconds and 5 git commands to generate.