Skip to contentSkip to conversation

ubifs: Fix synced_i_size calculation for xattr inodes

PATCH In review Richard Weinberger 1 participant 2 messages Feb 14, 2018

Subsystems (3)
lore
Share & tools
lore

Richard Weinberger

author maintainer
#0 lore raw

PATCH 1/1 ubifs: Fix synced_i_size calculation for xattr inodes

In ubifs_jnl_update() we sync parent and child inodes to the flash, in case of xattrs, the parent inode (AKA host inode) has a non-zero data_len. Therefore we need to adjust synced_i_size too.

This issue was reported by ubifs self tests unter a xattr related work
load.
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: ui_size is 4, synced_i_size is 0, but inode is clean UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: i_ino 65, i_mode 0x81a4, i_size 4

Fixes 1e51764a3c2a ("UBIFS: add new flash file system")
---
 fs/ubifs/journal.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ubifs/journal.c +2 -0
index 04c4ec6483e5..e3e1e093db81 100644
@@ -664,6 +664,8 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
 	finish_reservation(c);
 	spin_lock(&ui->ui_lock);
 	ui->synced_i_size = ui->ui_size;
+	if (xent)
+		host_ui->synced_i_size = host_ui->ui_size;
 	spin_unlock(&ui->ui_lock);
 	mark_inode_clean(c, ui);
 	mark_inode_clean(c, host_ui);
Signature · 1 line
2.13.6
author maintainer
#1 lore raw

Am Mittwoch, 14. Februar 2018, 12:02:48 CET schrieb Richard Weinberger:

Quoted 22 lines

In ubifs_jnl_update() we sync parent and child inodes to the flash, in case of xattrs, the parent inode (AKA host inode) has a non-zero data_len. Therefore we need to adjust synced_i_size too.

This issue was reported by ubifs self tests unter a xattr related work load.
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: ui_size is 4, synced_i_size is 0, but inode is clean UBIFS error (ubi0:0 pid 1896):
dbg_check_synced_i_size: i_ino 65, i_mode 0x81a4, i_size 4

Fixes 1e51764a3c2a ("UBIFS: add new flash file system")
---
 fs/ubifs/journal.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ubifs/journal.c +0 -0
index 04c4ec6483e5..e3e1e093db81 100644

fs/ubifs/journal.c int ubifs_jnl_update(struct ubifs_info *c, const struct · line 669

Quoted 6 lines
fs/ubifs/journal.c +2 -0
@@ -664,6 +664,8 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct
 inode *dir, finish_reservation(c);
 	spin_lock(&ui->ui_lock);
 	ui->synced_i_size = ui->ui_size;
+	if (xent)
+		host_ui->synced_i_size = host_ui->ui_size;
 	spin_unlock(&ui->ui_lock);

Reviewing my own patch on LKML helps a lot.
We need to take host_ui->ui_lock too...

Thanks,
//richard