Return-Path: Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:37186 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727582AbeLIWHM (ORCPT ); Sun, 9 Dec 2018 17:07:12 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Richard Weinberger" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: Subject: [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Richard Weinberger commit 59965593205fa4044850d35ee3557cf0b7edcd14 upstream. 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") Signed-off-by: Richard Weinberger [bwh: Backported to 3.16: s/host_ui/dir_ui/] Signed-off-by: Ben Hutchings --- fs/ubifs/journal.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -657,6 +657,11 @@ int ubifs_jnl_update(struct ubifs_info * spin_lock(&ui->ui_lock); ui->synced_i_size = ui->ui_size; spin_unlock(&ui->ui_lock); + if (xent) { + spin_lock(&dir_ui->ui_lock); + dir_ui->synced_i_size = dir_ui->ui_size; + spin_unlock(&dir_ui->ui_lock); + } mark_inode_clean(c, ui); mark_inode_clean(c, dir_ui); return 0;