Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3537054imu; Mon, 7 Jan 2019 05:16:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7iadcl+O+f1l9cI3gYlvQCzDx/YdTs4p31vFgTGnF1a3z1OaRsbk35rKcu5GJruWoJS3O6 X-Received: by 2002:a17:902:e002:: with SMTP id ca2mr62119221plb.103.1546866986890; Mon, 07 Jan 2019 05:16:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866986; cv=none; d=google.com; s=arc-20160816; b=ZzmBMekYF6wS9vPzkRInJNzrzcIqOB8AzzysxmL1Ag8BHEivmOrRnbkgc1bsSVGlp0 KaFNQRJ5saDRMpmp/bKXNCYpWxvV7RD4N+TeAcfJZRC/Q5vpX9aLQ+7/oHhP5pjvwxXE QboDE7+ccjzLHcd5x9C7VAwKvJ1Rzd+p/hduPYi+lk2gcLTx9cFUkdEadI12AyPrQGm1 p4mh0noYJ1LUW4CB+rmxcchWyFJMk3iV0SV8EarFImXOBV9MGhzQnoU/4OwajrP6EQ/O qwjfmqqC2omlm6NUx6cPdLYuYI8XKAOBYbqhtK60AxrImtw8oD78G5rGpvGxuQJVIqFN jTEQ== 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=WPeL23ghB0N4aCpMgcfM+ynCziDNq/3PgtEBxwLS//8=; b=gUNoN9w8iS5aOWp5mbzIHukms8TBcaMcSiCIrZ0/nj4ASD054iW6fov1dmjb/5ymQm caKnuMtUkKsBugHJYrM11flf4owoytjbM8tJZvuIRrNqvJBVRE2Uj0Nl8X46z+rIM2Wk QPfbYZk+7gMZHt74fDWbt6eyykrEZvYCWnAA7jqGv7ZDA1bgo1YrynO+Es7OqFuQv9jH fkKZHCYpNmZQeLQwZdU/e15ofW2amR/bddBM1cRA1YuOwHnzN3Ul1C9FyGcSRtTxmiJe xi0noQUAHeEKQ0ifIuutCqEhxoiV+nWY/hAGdf40urntLQ8q5vFzkK8TAVhP9cWtWn1R ZUmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CMG5/sX3"; 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 o192si22322923pgo.129.2019.01.07.05.16.11; Mon, 07 Jan 2019 05:16:26 -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="CMG5/sX3"; 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 S1730872AbfAGNCt (ORCPT + 99 others); Mon, 7 Jan 2019 08:02:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:50272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730220AbfAGNCq (ORCPT ); Mon, 7 Jan 2019 08:02:46 -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 7E0C82089F; Mon, 7 Jan 2019 13:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866166; bh=Rj8dEl5Z+Y1jOJZwvi4fPUVfyfOadydUli5TTD2a0uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMG5/sX3b/32JTY6lPk5ERB3G5SBr6WezRbi9vpogBg366bbmrkXk0tuGeUzNESmA xFIT4WaXTwkxk7M8wcw/yCk4Xy2mRVximynBKMavVrWbUDw4lliSxu61hJvQ1cXB95 SEEBN9oy79Ri5tvRFB6c5UyY6Sl61TQ7hYjrgWHk= 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.14 067/101] ext4: force inode writes when nfsd calls commit_metadata() Date: Mon, 7 Jan 2019 13:32:55 +0100 Message-Id: <20190107105336.648345003@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit fde872682e175743e0c3ef939c89e3c6008a1529 upstream. Some time back, nfsd switched from calling vfs_fsync() to using a new commit_metadata() hook in export_operations(). If the file system did not provide a commit_metadata() hook, it fell back to using sync_inode_metadata(). Unfortunately doesn't work on all file systems. In particular, it doesn't work on ext4 due to how the inode gets journalled --- the VFS writeback code will not always call ext4_write_inode(). So we need to provide our own ext4_nfs_commit_metdata() method which calls ext4_write_inode() directly. Google-Bug-Id: 121195940 Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 11 +++++++++++ include/trace/events/ext4.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1153,6 +1153,16 @@ static struct dentry *ext4_fh_to_parent( ext4_nfs_get_inode); } +static int ext4_nfs_commit_metadata(struct inode *inode) +{ + struct writeback_control wbc = { + .sync_mode = WB_SYNC_ALL + }; + + trace_ext4_nfs_commit_metadata(inode); + return ext4_write_inode(inode, &wbc); +} + /* * Try to release metadata pages (indirect blocks, directories) which are * mapped via the block device. Since these pages could have journal heads @@ -1361,6 +1371,7 @@ static const struct export_operations ex .fh_to_dentry = ext4_fh_to_dentry, .fh_to_parent = ext4_fh_to_parent, .get_parent = ext4_get_parent, + .commit_metadata = ext4_nfs_commit_metadata, }; enum { --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h @@ -225,6 +225,26 @@ TRACE_EVENT(ext4_drop_inode, (unsigned long) __entry->ino, __entry->drop) ); +TRACE_EVENT(ext4_nfs_commit_metadata, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode), + + TP_STRUCT__entry( + __field( dev_t, dev ) + __field( ino_t, ino ) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + ), + + TP_printk("dev %d,%d ino %lu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino) +); + TRACE_EVENT(ext4_mark_inode_dirty, TP_PROTO(struct inode *inode, unsigned long IP),