From patchwork Mon Jun 24 11:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13709349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01286C2BD05 for ; Mon, 24 Jun 2024 11:24:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 535426B0113; Mon, 24 Jun 2024 07:24:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E5016B03D6; Mon, 24 Jun 2024 07:24:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AD1A6B0117; Mon, 24 Jun 2024 07:24:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 19F216B03D6 for ; Mon, 24 Jun 2024 07:24:18 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BFA34A0C09 for ; Mon, 24 Jun 2024 11:24:17 +0000 (UTC) X-FDA: 82265548554.15.E0A987E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 12CB214000C for ; Mon, 24 Jun 2024 11:24:15 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Lo4q6NtI; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719228242; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=1MZhBdhakyXXyis3UviwdkIkQ/9gObuVjuoXkcPA6zY=; b=uS0vIJTkL20Rsy1bS9xoDqKdhDSd4jkS7DYvYq8ZCiQniJn9WTI2J5X/jBSNwXHTNFO+Jh zIeNBZzsgs3benAbz6fQkPYeZtREPEUaM4QeqheqrRzk5pchOOKiEpiJ83ci5qEvpC5UZx FbbLS80eqJ2nDWaVXTWyK+OvY9BCCBc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719228242; a=rsa-sha256; cv=none; b=4qKX5DaZyVkFgZj5MiOACVZ4m/2nOxwN2Jq7i0rXVJWH6i28vFUf1CeloKhi32YPvGs/1b 2UOwHAkjWAo7jsZgQdHCt03QyXf35FikM72Gtp1W9TUUfjETYGdEQ40nySxg4+WgTIoDBu S21+v9gqtL5ZQgiqyoT/wyDyu07DKo8= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Lo4q6NtI; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719228255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1MZhBdhakyXXyis3UviwdkIkQ/9gObuVjuoXkcPA6zY=; b=Lo4q6NtI4LvVJh4lEg1eUEbHhLBk5OuZNw2OH79NGS+2fy10ilgIKRsZs1QId5DZV6/Dv+ czN0lDhIJ2mwxvgHpQVPeq82L6cVJXjIJ0agg+nm9Bzn7V0nA8idEjaNEAwPYiifoGF+FS ypwVBisEn35ac7IrPP8JyAW2XfIOe3Y= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-O_GMqFPHO-OqoLHMuqV_Ew-1; Mon, 24 Jun 2024 07:24:10 -0400 X-MC-Unique: O_GMqFPHO-OqoLHMuqV_Ew-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 24006195608C; Mon, 24 Jun 2024 11:24:08 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.111]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D0541956051; Mon, 24 Jun 2024 11:24:04 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Christian Brauner , Matthew Wilcox cc: dhowells@redhat.com, Jeff Layton , netfs@lists.linux.dev, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfs: Fix netfs_page_mkwrite() to flush conflicting data, not wait MIME-Version: 1.0 Content-ID: <614299.1719228243.1@warthog.procyon.org.uk> Date: Mon, 24 Jun 2024 12:24:03 +0100 Message-ID: <614300.1719228243@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Signature: 1ed8sakmnq133hr81s8wuo77nwxdyjms X-Rspamd-Queue-Id: 12CB214000C X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719228255-387241 X-HE-Meta: U2FsdGVkX1/TiVKHkqBvxEBuISBf2LnQKhlOiSwhGZdFE4+YRzwHRcQ7lqhHv++KFw1OehlsXPy/gfxS3CIq3rjD/XVp9SafCNs8btxI6E+wLgcDPFy+RN4qizcazPCy9XU6VdJit92YIspDLZ+x8nVohqdWLJuzg+vebtMJTexML6G/9MP3He9fja0Vb4NuMR9da9zNclXUk/DJ6hzd3g4aFirCW17FuWGfEXq/LxWTUUeL8JKujKiIRPkV+U1MC1GIBLNLt3LVzR8/AVbacAEePVxrqgZ621DDww01rHj0zkXVwEW1mhFsL9ipsKX+0xq+ykRdcvMmquU+Gliz4wzGD2uLHs2soppZPWdVr2MWVI8WVd8GS06RbwqcJTI6Cu3zxTosPdZybLJOL7yVkc258EPzV4N9rASmMylroHmxOzRFFtMga2kdnVRbc5TsGj79jwTZL6+Ja3OcUt8bLuS1xMSk0OPF+lZf+1zNr7HcDEQZlCVfECpU5uFCOZBIA8qGiL5DDIUxI+cnDAkV/w/G1sOJNaEiONRmfSeLqXQpCUl/kxEbSlp3jJrgfJ/oPvuqzZCs1hxwKBSNfb4KuH8VuBBVoQ7iSWglXa1gtyce3OiEQpWDwowCD5pOSaEMkTixg3l8ESYCSnZc0C/+eFEx/eBcmXIt2BWDBVNJ9sZdUIrxwtCNWrG2Yqo1aukkY2yLPXzBhd8Xx6Jyp790gxMFj1g0CFEx7wt1tHaUMj7VpvQ1rpzyhzrgu4HMLahl4/SEYfYXR+P5i7ceW9F9GSAuUSKWzUk0lUAMrFh/5FtjHEBaynVNKtMJ0htWC6b69p60OJ9rbC0HQMJwpI4qGjh9jBtju765uXysZAyIHly782e4wVrnsr55Y7GDbDPlX3zbq2dIc+nxgSrhnEAHwSS/yOotJPYAzTJjuN5GqB9G6c/M/+zdOWtLKQRxTgqAnjKiyVXwS1S340QROKL nl3CdXAr qTEWaip4rYrDLipr4sr3TdndYHIuzrOldYRCH/gkSQzYGY7eh3dDDY/q6IAGdt/BR+0wUM9C2f3a+w78f/5csGge+oYCKd0tuUuHj9ZX8/ePWkLCLa8Q28IEt33i1bQZaGL1YznNP6S+y85GA30i0EUWQ3dXQ9vnezJLC4LBmrxDlnPPRwHyHoD49m5EWmqsezNOqlnguDHjuIRNM2JkMGB/nmgIWrUel4za0EjfUf8+ozirSQLLbghUuFMZbhafjSYBFddHHa+ZgndCJ6q3y6PHsP8Pf78yYORK7uneHRB0pZ4KAfSVqcVi14DyHl2+kJd9E4/a/gH3A35IIw0Yd9hAB7aHdJAbq517leCEJnA29Jb/WotyhKsutUPd4HNW+gU3ji2fIzAONv96W3S1IchMyA3CJFRWoPfg8CHyxz7aGcJxriWIUMeiSI6Wbe3uui9jZEUDTk59SSJRdN5hgEDvUrwbuNwBWPx9xrhYwGRD5tWVI0v0b7Lxnh+9fPIceXp6wSPymQtTvBdCbfHI9ZYf3+fqUa1VFd6EQFF6w1cch8Vm4cCdouiqX0Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Fix netfs_page_mkwrite() to use filemap_fdatawrite_range(), not filemap_fdatawait_range() to flush conflicting data. Fixes: 102a7e2c598c ("netfs: Allow buffered shared-writeable mmap through netfs_page_mkwrite()") Signed-off-by: David Howells cc: Matthew Wilcox cc: Jeff Layton cc: netfs@lists.linux.dev cc: v9fs@lists.linux.dev cc: linux-afs@lists.infradead.org cc: linux-cifs@vger.kernel.org cc: linux-mm@kvack.org cc: linux-fsdevel@vger.kernel.org --- fs/netfs/buffered_write.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 05745bcc54c6..9cbbeeee6170 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -554,9 +554,9 @@ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_gr group = netfs_folio_group(folio); if (group != netfs_group && group != NETFS_FOLIO_COPY_TO_CACHE) { folio_unlock(folio); - err = filemap_fdatawait_range(mapping, - folio_pos(folio), - folio_pos(folio) + folio_size(folio)); + err = filemap_fdatawrite_range(mapping, + folio_pos(folio), + folio_pos(folio) + folio_size(folio)); switch (err) { case 0: ret = VM_FAULT_RETRY;