Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2985008imu; Sun, 9 Dec 2018 14:18:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/VifcAO1DesMgExABuzvJFlms42eGkv8vfIvRd8mHUJsYzAAVfXIB+O8QsKEZA8QlRufLPv X-Received: by 2002:a63:4a0a:: with SMTP id x10mr8782806pga.237.1544393919293; Sun, 09 Dec 2018 14:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544393919; cv=none; d=google.com; s=arc-20160816; b=OYG2qw03EaBzGn3uFdXT+r2OqzlIWyC/VNQXdiy/ERn3B+VZ6PqYsTdf16mk/kX2qq PNwQmXLiVjGedVLbVAEVwVe8r6+HwcSbMaiLipXC9vhdIL5DBvcF8UgAZwUy6dOUax0p G5eMtr35nRO3JBctU8TJJKMd73H8dnbK4t2U9B6HDy7LocFY3lSrdpsoVj1L7ow2hi2n xuwIj1Nw0U8eD7CUO5LGwz9hERHEnAfuN6eZ97xf5qFeQQ94e4h0av0KtukR+VM3HpqJ o/4lyQq8HCtaqrRr/clyjJQ9SYsc82K3OAbh/VKHTb1pL0/ui/VL3k91PeBKU6Nfjea1 qBbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=pO4y9PV7PoPyNET4A2gGGGachGy6ngDFEEGhkbkzwdw=; b=sFCHRNMzKdZ6d7b25zL/x7cCIpF+Nz2L9tn0AjK6XCNWXH5gyln3VLs5vHvELQIMLn NuvpSB3uQ4nh8hlzJwbQ73T3d237ojxtuITw1m1e7o+3WoPW9cZOukgDT2oWViRG6Q4J jq1+4KUmiVRtBmbaJfMHIPozangCo4M/jQZ4iIciMWn4y7MV1vi0/5tZju52DIqoLEks 9rsWd63CJArcugtO1KiUmXqqfAdgpHSqaSsEHTtrLMcCBidGL7CtnTyDMLOeD+prp3cM U2WGQs+pqN2mW40eHFe5vZMLeY6fpyjotb3n6I5JQsLqhdaw+Hcxtupy90nLxmrsmUst oJ/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si8726229pfh.229.2018.12.09.14.18.24; Sun, 09 Dec 2018 14:18:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727888AbeLIWHZ (ORCPT + 99 others); Sun, 9 Dec 2018 17:07:25 -0500 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 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW73C-0002ik-7g; Sun, 09 Dec 2018 21:55:46 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72d-0003ON-Gy; Sun, 09 Dec 2018 21:55:11 +0000 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: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;