Received: by 10.223.185.116 with SMTP id b49csp395378wrg; Fri, 16 Feb 2018 00:27:09 -0800 (PST) X-Google-Smtp-Source: AH8x227uXzPBwtzaf+zr+RbT6KggzyIyauAyug/zUPUbJhBZty2aIMWnxJtPFyj7oLvIWgCA5brl X-Received: by 10.98.72.10 with SMTP id v10mr5382071pfa.128.1518769628967; Fri, 16 Feb 2018 00:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518769628; cv=none; d=google.com; s=arc-20160816; b=kib1JKuqFOA0/kKgqi1PzTUzei6uNo7fNQ8c+tsM5GV0geBvqQczsIJCtJbIlzkfgH 8ddHT/zRAAi3ktoIcgVDoNQpnCdvq8W4jBO8QQfsTsXlfgM+n4qbP1/eG2KRw5mGTvwI Cw8AjVVIe2e6BPy7xEvDbpTi8OUT12GmiTUsN8JcQNU9FbsUhcfhQerBN/quASVHBRrt MRAsif7Zf9DPB/AUrLSzCJWgxMA5+h59OX2ODfMsELvogr/OLPE2K9N8iUl+4M+LE81N b/m1hcuN+mWckQLJF/6E9WT2cwR8edq34bC06hlTv25ESzNUOrCtGJX24d0Hj1r2i9PI IMJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WGp3g6B+7Q8JLNiiV2EU765747deKJp+alYFksimKBM=; b=jhsh5DOCYgPzRHVb1WQnwHXkBvai+FYSGbKp/Fiy2SkeD9muvj+l/MhF91dd72SzW+ dhnqk2ts2D+E+hYKJv/vMJxcybMKNuv/TCf6LHuULoDb8aYzNp7aJqSVQbRlDdGjcpxZ s6351+x97R0EqnQHdesFEDJguOe70pAIJTey9h0FULjfOyWXBSqn8bd+Gq4mQeAtHjLI XpBlxfSp5sI5eo37kehxlPVISfYdymFWhTUtaEuGrl9scTgci9PhrP9bL3N+XqiXBIXU eCEojWZeLfAGXyw0AOhfWpeW6cDAI2vBbetZ9VnCUCUwYzKZ9V4UBMXd/6qrcSwKXgOD o/ZQ== 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 y12si1593500pgr.152.2018.02.16.00.26.54; Fri, 16 Feb 2018 00:27:08 -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 S1425857AbeBOQZm (ORCPT + 99 others); Thu, 15 Feb 2018 11:25:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33868 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033750AbeBOPnM (ORCPT ); Thu, 15 Feb 2018 10:43:12 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0EF941150; Thu, 15 Feb 2018 15:43:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.15 102/202] NFS: Fix a race between mmap() and O_DIRECT Date: Thu, 15 Feb 2018 16:16:42 +0100 Message-Id: <20180215151718.630262423@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust commit e231c6879cfd44e4fffd384bb6dd7d313249a523 upstream. When locking the file in order to do O_DIRECT on it, we must unmap any mmapped ranges on the pagecache so that we can flush out the dirty data. Fixes: a5864c999de67 ("NFS: Do not serialise O_DIRECT reads and writes") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/io.c +++ b/fs/nfs/io.c @@ -99,7 +99,7 @@ static void nfs_block_buffered(struct nf { if (!test_bit(NFS_INO_ODIRECT, &nfsi->flags)) { set_bit(NFS_INO_ODIRECT, &nfsi->flags); - nfs_wb_all(inode); + nfs_sync_mapping(inode->i_mapping); } }