提交 a76284e6 编写于 作者: S Subodh Nijsure 提交者: Artem Bityutskiy

UBIFS: fix a couple bugs in UBIFS xattr length calculation

The journal update function did not work for extended attributes properly,
because extended attribute inodes carry the xattr data, and the size of this
data was not taken into account.

Artem: improved commit message, amended the patch a bit.
Signed-off-by: NSubodh Nijsure <snijsure@grid-net.com>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: NBen Shelton <ben.shelton@ni.com>
Acked-by: NBrad Mouring <brad.mouring@ni.com>
Acked-by: NGratian Crisan <gratian.crisan@ni.com>
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
上级 b81000b6
...@@ -571,7 +571,11 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, ...@@ -571,7 +571,11 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
aligned_dlen = ALIGN(dlen, 8); aligned_dlen = ALIGN(dlen, 8);
aligned_ilen = ALIGN(ilen, 8); aligned_ilen = ALIGN(ilen, 8);
len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ; len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
/* Make sure to also account for extended attributes */
len += host_ui->data_len;
dent = kmalloc(len, GFP_NOFS); dent = kmalloc(len, GFP_NOFS);
if (!dent) if (!dent)
return -ENOMEM; return -ENOMEM;
...@@ -648,7 +652,8 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, ...@@ -648,7 +652,8 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
ino_key_init(c, &ino_key, dir->i_ino); ino_key_init(c, &ino_key, dir->i_ino);
ino_offs += aligned_ilen; 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,
UBIFS_INO_NODE_SZ + host_ui->data_len);
if (err) if (err)
goto out_ro; goto out_ro;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册