Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp713299imj; Wed, 13 Feb 2019 16:19:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IYRFFnlchdmwT+dudHawzuK0l6YzBajNd40ihVJRvhWb/l2gnnADdtbFJFXwer4wk+slwIH X-Received: by 2002:a62:e082:: with SMTP id d2mr986148pfm.240.1550103567960; Wed, 13 Feb 2019 16:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103567; cv=none; d=google.com; s=arc-20160816; b=GyJxYrpR6XGSS6WB3YNExSCsF1E72PWX0HAlwGvQSKv9VP2ItQRM2+PPWRSB0nNDHn ACI3XdtwqFHdnnOQ+2wdZILLlGAA/2kv5nP+J2ccqE4tFEGg9UW1uwkLFKy7ijrwlxgH 29bzYSzMpzFTfBlIrDpoMs8WQgyraPq0iORqCgS/rzeUQWgxmnUZQ64nvTouflKhufoH ZGJ59injjrKJ/4V+1e1PABZKOvpaSifjfXrBFLaLnew0THKaAfLB5woL4PPr04L/J8Zp 0DZ8rIeX5/s3LbRYif9aa1oltiTcR7BJH5L13Tf0ZIbL/MIDRJpmcRuiQHaZsF0i6xs/ FOqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XXZODSrG2TRWS/EIndYG86CZkWazznXhbKT137Se3XU=; b=Em0nmoX+Vdp1AbWBSE+nq3Vc7bqra5sNqBB0X2FjTT6IPvNl8nhdCIss5B6XYWxhoE cyc7r8bhplThxoR5c5j8UatS9VJaK0XIOX89szsoz9/TuJbm4ppHA1mDJdD6zdFiQW00 l+rAZL3+/fELswUTyc40Fa2GT1kgFvETJMpNkLFacH+ebTSijN1l3X4qA0lQzri/W0nC 9nOJZ8oCcsmQnjXdssacETlPGiLctxmqh0ZUS7yXnt4xU7jB+jE4rpLAdJ/MYY4wI8IZ FXOT3qlPY+Rs6YbeIQS755B36TQuAQ4GTNwNJW6U+nAucSo6gld0RWrUxGroUpaIP4i0 147Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KeKmBl0I; 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 ci9si855171plb.252.2019.02.13.16.19.12; Wed, 13 Feb 2019 16:19:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b=KeKmBl0I; 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 S2406519AbfBMSqs (ORCPT + 99 others); Wed, 13 Feb 2019 13:46:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:45288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406497AbfBMSqn (ORCPT ); Wed, 13 Feb 2019 13:46:43 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A687920811; Wed, 13 Feb 2019 18:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083603; bh=Hbf0xLssCghT4W7m2Q/2dJlZfJLco96g6vP0aKu74Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KeKmBl0I3AvlpxlGaS9XScH9WlwHjlIqffBathaiPRnIgGTObYiQgdNJef5cnameu T/oyoQzjf/RPJmvO/qKhW+L+c/qEKMPXn0jWrWQBvq8rMvcpTFnSQNExaoInIb5GRw jJBhwVdQEYLIDrRqL/jErvs7G0N6/WGM5IQADMDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso Subject: [PATCH 4.20 46/50] Revert "ext4: use ext4_write_inode() when fsyncing w/o a journal" Date: Wed, 13 Feb 2019 19:38:51 +0100 Message-Id: <20190213183659.307182878@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit 8fdd60f2ae3682caf2a7258626abc21eb4711892 upstream. This reverts commit ad211f3e94b314a910d4af03178a0b52a7d1ee0a. As Jan Kara pointed out, this change was unsafe since it means we lose the call to sync_mapping_buffers() in the nojournal case. The original point of the commit was avoid taking the inode mutex (since it causes a lockdep warning in generic/113); but we need the mutex in order to call sync_mapping_buffers(). The real fix to this problem was discussed here: https://lore.kernel.org/lkml/20181025150540.259281-4-bvanassche@acm.org The proposed patch was to fix a syzbot complaint, but the problem can also demonstrated via "kvm-xfstests -c nojournal generic/113". Multiple solutions were discused in the e-mail thread, but none have landed in the kernel as of this writing. Anyway, commit ad211f3e94b314 is absolutely the wrong way to suppress the lockdep, so revert it. Fixes: ad211f3e94b314a910d4af03178a0b52a7d1ee0a ("ext4: use ext4_write_inode() when fsyncing w/o a journal") Signed-off-by: Theodore Ts'o Reported: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fsync.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -116,16 +116,8 @@ int ext4_sync_file(struct file *file, lo goto out; } - ret = file_write_and_wait_range(file, start, end); - if (ret) - return ret; - if (!journal) { - struct writeback_control wbc = { - .sync_mode = WB_SYNC_ALL - }; - - ret = ext4_write_inode(inode, &wbc); + ret = __generic_file_fsync(file, start, end, datasync); if (!ret) ret = ext4_sync_parent(inode); if (test_opt(inode->i_sb, BARRIER)) @@ -133,6 +125,9 @@ int ext4_sync_file(struct file *file, lo goto out; } + ret = file_write_and_wait_range(file, start, end); + if (ret) + return ret; /* * data=writeback,ordered: * The caller's filemap_fdatawrite()/wait will sync the data.