]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.69/ubifs-fix-synced_i_size-calculation-for-xattr-inodes.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.69 / ubifs-fix-synced_i_size-calculation-for-xattr-inodes.patch
1 From 59965593205fa4044850d35ee3557cf0b7edcd14 Mon Sep 17 00:00:00 2001
2 From: Richard Weinberger <richard@nod.at>
3 Date: Tue, 12 Jun 2018 00:52:28 +0200
4 Subject: ubifs: Fix synced_i_size calculation for xattr inodes
5
6 From: Richard Weinberger <richard@nod.at>
7
8 commit 59965593205fa4044850d35ee3557cf0b7edcd14 upstream.
9
10 In ubifs_jnl_update() we sync parent and child inodes to the flash,
11 in case of xattrs, the parent inode (AKA host inode) has a non-zero
12 data_len. Therefore we need to adjust synced_i_size too.
13
14 This issue was reported by ubifs self tests unter a xattr related work
15 load.
16 UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: ui_size is 4, synced_i_size is 0, but inode is clean
17 UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: i_ino 65, i_mode 0x81a4, i_size 4
18
19 Cc: <stable@vger.kernel.org>
20 Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
21 Signed-off-by: Richard Weinberger <richard@nod.at>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 fs/ubifs/journal.c | 5 +++++
26 1 file changed, 5 insertions(+)
27
28 --- a/fs/ubifs/journal.c
29 +++ b/fs/ubifs/journal.c
30 @@ -665,6 +665,11 @@ int ubifs_jnl_update(struct ubifs_info *
31 spin_lock(&ui->ui_lock);
32 ui->synced_i_size = ui->ui_size;
33 spin_unlock(&ui->ui_lock);
34 + if (xent) {
35 + spin_lock(&host_ui->ui_lock);
36 + host_ui->synced_i_size = host_ui->ui_size;
37 + spin_unlock(&host_ui->ui_lock);
38 + }
39 mark_inode_clean(c, ui);
40 mark_inode_clean(c, host_ui);
41 return 0;