Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F066C169C4 for ; Thu, 31 Jan 2019 14:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5749F218AC for ; Thu, 31 Jan 2019 14:19:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="ICfwDXaB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727391AbfAaOTr (ORCPT ); Thu, 31 Jan 2019 09:19:47 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:63511 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727237AbfAaOTr (ORCPT ); Thu, 31 Jan 2019 09:19:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1548944386; x=1580480386; h=from:to:cc:subject:date:message-id; bh=7MBOBXsm3cn+P19ajIWs0ePUTpvSwyCS5nF30Sg4JvU=; b=ICfwDXaBBiGA+qeTFMovcgtcYt03KsSQZ6nuJZxfAK6dY7yDsAhi9QkV JZtUrwDTPl1OnMnS6Tgk/JkvnK3I5Rp1PTfsR1zrKLLmcmFNZMrxVEqxk 6FhcT/1A1mpgxFeOU/svgHirrlDiDDXaZ2KHJkeigH3JJKF43vY/5hfPQ c=; X-IronPort-AV: E=Sophos;i="5.56,544,1539648000"; d="scan'208";a="779937370" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 31 Jan 2019 14:19:43 +0000 Received: from uc85b769cb5fa590192ed.ant.amazon.com (pdx2-ws-svc-lb17-vlan2.amazon.com [10.247.140.66]) by email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com (Postfix) with ESMTPS id 7FD0FA22E5; Thu, 31 Jan 2019 14:19:42 +0000 (UTC) Received: from uc85b769cb5fa590192ed.ant.amazon.com (localhost [127.0.0.1]) by uc85b769cb5fa590192ed.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id x0VEJeQa021337; Thu, 31 Jan 2019 15:19:40 +0100 Received: (from jdw@localhost) by uc85b769cb5fa590192ed.ant.amazon.com (8.15.2/8.15.2/Submit) id x0VEJe3G021336; Thu, 31 Jan 2019 15:19:40 +0100 From: Jimmy Durand Wesolowski To: stable@vger.kernel.org Cc: David Woodhouse , Amit Shah , Stefan Nuernberger , Frank Becker , Jimmy Durand Wesolowski Subject: [PATCH 1/1] fs: add the fsnotify call to vfs_iter_write Date: Thu, 31 Jan 2019 15:19:39 +0100 Message-Id: <1548944379-21257-1-git-send-email-jdw@amazon.de> X-Mailer: git-send-email 2.7.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org A bug has been discovered when redirecting splice output to regular files on EXT4 and tmpfs. Other filesystems might be affected. This commit fixes the issue for stable series kernel, using one of the change introduced during the rewrite and refactoring of vfs_iter_write in 4.13, specifically in the commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write"). This issue affects v4.4 and v4.9 stable series of kernels. Without this fix for v4.4 and v4.9 stable, the following upstream commits (and their dependencies would need to be backported): * commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write") * commit 18e9710ee59c ("fs: implement vfs_iter_read using do_iter_read") * commit edab5fe38c2c ("fs: move more code into do_iter_read/do_iter_write") * commit 19c735868dd0 ("fs: remove __do_readv_writev") * commit 26c87fb7d10d ("fs: remove do_compat_readv_writev") * commit 251b42a1dc64 ("fs: remove do_readv_writev") as well as the following dependencies: * commit bb7462b6fd64 ("vfs: use helpers for calling f_op->{read,write}_iter()") * commit 0f78d06ac1e9 ("vfs: pass type instead of fn to do_{loop,iter}_readv_writev()") * commit 7687a7a4435f ("vfs: extract common parts of {compat_,}do_readv_writev()") In order to reduce the changes, this commit uses only the part of commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write") that fixes the issue. This issue and the reproducer can be found on https://bugzilla.kernel.org/show_bug.cgi?id=85381 Reported-by: Richard Li Reported-by: Chad Miller Reviewed-by: Stefan Nuernberger Reviewed-by: Frank Becker Signed-off-by: Jimmy Durand Wesolowski --- fs/read_write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index ba28059..9819f7c 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -392,8 +392,10 @@ ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos) iter->type |= WRITE; ret = file->f_op->write_iter(&kiocb, iter); BUG_ON(ret == -EIOCBQUEUED); - if (ret > 0) + if (ret > 0) { *ppos = kiocb.ki_pos; + fsnotify_modify(file); + } return ret; } EXPORT_SYMBOL(vfs_iter_write); -- 2.7.4