Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5253023imu; Tue, 15 Jan 2019 14:08:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN6BMOB1NhxtAbQGx7pXZI1GhXOHuS1Gpzo9saz1Cj8vBXFsO2O7bu9g+GQz22ynaHstuP/0 X-Received: by 2002:a17:902:ac8f:: with SMTP id h15mr6180526plr.245.1547590113998; Tue, 15 Jan 2019 14:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590113; cv=none; d=google.com; s=arc-20160816; b=Kx5EPhFpNbGuGBZHhgQiATnLQKF8IxkA9OtB1/+xOE9JJUZUMSuzSKpdw3gX2sCYy0 qpyVTfL35JE2FfLzfpVeYGIy57mzgcsGa+MI8oxzbCDGU8PYIHn+TAQpZ/3Jj4eCqEeC MUXnoBD9/Mov9/gipMDn79ViWajoSUp+tL5OO5IYX7lkSW79nPdoSX6dc24U8Uwk0Vmu II8uPuPfJPGdW+5z51KWCqZ6oU9DpHv7FXkXj74O+we5cpBo/YCMXt5Z3qac246dfurM /fsKb0l0LvwnqhwyqDV3zktfeofCvWCxoIV1xLeg3xcFZtsX8i8EQmEKk/zQD+w7Rs8K g50g== 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=JygHOt4A+yIiGOGZAN4ZhtI0yMbUyWx5hogVcA/Llyc=; b=hl6tmiUn/ExD9vnTHDX92mQ9MOoLgNbZQNGo1P/fz4msfwO6t6/OVhYE1PYtkPCpP+ QhxM5BrnFuVyoXglIuuFAT0uUbb4ZXXabZyaWtM/5QaZCo0fZ5kfeqGO6BsxBKYzPvPn nHWysEYJ93GACl1wJv65znsOPBc5zSuLbLTWuLC6OErKe+pHV+1x2VGfNO1xMCIQR8QS zrSX+GKqyQ0xakESd3GXugEOvH3X2umw2ZqepO+PLcTvL7FGSsuwyZe7K37B2CoeIGwk ZXVwa4DodNF9g4Qssu6L+0g/PokCdeSgNiK1CL0xY+v0KHznpVCGleI5sE4TF6QvhvXP A7+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pt88z3xk; 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 g18si4273347pgg.522.2019.01.15.14.08.14; Tue, 15 Jan 2019 14:08:33 -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=Pt88z3xk; 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 S2387826AbfAOQpi (ORCPT + 99 others); Tue, 15 Jan 2019 11:45:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:35286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387808AbfAOQpc (ORCPT ); Tue, 15 Jan 2019 11:45:32 -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 CC34A2054F; Tue, 15 Jan 2019 16:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570732; bh=peZIb1sBmdwMzTxAUJ3NjYM+cdjao2OUVMQINyzeRvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pt88z3xk9xYSg4Esp+PUSF2GqwSTotblbVFWdN/pjSwuAszrsjRZ7lws4S6LviJ17 pLkUmOicClqgtsAiJox+mAFKCdCsAyxKAePi1Rjck6ZyaqBTYMZXhKfWbCQMpqfxUH 6hqg+7U1mElhARf8EDAzG2r9nKVa2QOzHRS32a20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org Subject: [PATCH 4.20 50/57] ext4: use ext4_write_inode() when fsyncing w/o a journal Date: Tue, 15 Jan 2019 17:36:31 +0100 Message-Id: <20190115154913.813038440@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@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 ad211f3e94b314a910d4af03178a0b52a7d1ee0a upstream. In no-journal mode, we previously used __generic_file_fsync() in no-journal mode. This triggers a lockdep warning, and in addition, it's not safe to depend on the inode writeback mechanism in the case ext4. We can solve both problems by calling ext4_write_inode() directly. Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fsync.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -116,8 +116,16 @@ 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) { - ret = __generic_file_fsync(file, start, end, datasync); + struct writeback_control wbc = { + .sync_mode = WB_SYNC_ALL + }; + + ret = ext4_write_inode(inode, &wbc); if (!ret) ret = ext4_sync_parent(inode); if (test_opt(inode->i_sb, BARRIER)) @@ -125,9 +133,6 @@ 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.