From mboxrd@z Thu Jan 1 00:00:00 1970 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 29780C61DA4 for ; Fri, 24 Feb 2023 14:31:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B62E6B0074; Fri, 24 Feb 2023 09:31:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 766736B007B; Fri, 24 Feb 2023 09:31:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62E046B007D; Fri, 24 Feb 2023 09:31:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5400E6B0074 for ; Fri, 24 Feb 2023 09:31:29 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2560BC0A71 for ; Fri, 24 Feb 2023 14:31:29 +0000 (UTC) X-FDA: 80502423498.06.71B2966 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 692DC12001B for ; Fri, 24 Feb 2023 14:31:25 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KXfPv0ep; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677249087; 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:in-reply-to:references:references:dkim-signature; bh=SOsL6NM2MJym+f7C6hxVzCVTtD6Lm6OnQWKMhqCZjP8=; b=uPQV9abrVs99fuk7GXovm8Aj9sMmxYoaIqs7amn4D6PonVpCQ662mIL5ARLaMGQqBjEtda +m1Hk5v4jSgSkLAuSJeRIeUVPC+80mWh8Ke+A/nWpJBMs2D95tmRunv2JGwWNldD9c7CVe v3OPykRDW7Il/3LpaYueONNgxEfDZDc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KXfPv0ep; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677249087; a=rsa-sha256; cv=none; b=cQv1ITzNaMly9/pqTEso0fEs/Fz8u5OXX1cNhjpIhqKQ4u0uPV+l1RCS2zc6TFuizPkDrq ipms33+1hfCa1LFIuHAuIYLwDaiOcWiX4NkJKlCepyi82S52bKrRVn2fBnfvTUNpsq9zoF bsGAYljtqWbLzVFvQMV9sDek5BrBOZM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677249084; 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: in-reply-to:in-reply-to:references:references; bh=SOsL6NM2MJym+f7C6hxVzCVTtD6Lm6OnQWKMhqCZjP8=; b=KXfPv0epzCF4V/QZNTW1aICEV+8EYnelt6iKqyGHbZQg6U0jPmUqefGFdLLCqjvmChWJbY Na3KpgZ5SMftJ1n/qWOUYSQSugQjqLFHwSGPEc7S2bBC+WAI1X90pz03GcrZxERlN2qPj2 fQt23a1LHPzwWhxbCHH2kUlexu+DpcE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-145-LZUo_cplOIC5eZZlXA46IQ-1; Fri, 24 Feb 2023 09:31:19 -0500 X-MC-Unique: LZUo_cplOIC5eZZlXA46IQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00110887400; Fri, 24 Feb 2023 14:31:18 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44AA6440D8; Fri, 24 Feb 2023 14:31:16 +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 In-Reply-To: <2134430.1677240738@warthog.procyon.org.uk> References: <2134430.1677240738@warthog.procyon.org.uk> <2009825.1677229488@warthog.procyon.org.uk> <20230220135225.91b0f28344c01d5306c31230@linux-foundation.org> To: Linus Torvalds , Steve French Cc: dhowells@redhat.com, Vishal Moola , Andrew Morton , Jan Kara , Paulo Alcantara , Matthew Wilcox , Huang Ying , Baolin Wang , Xin Hao , linux-mm@kvack.org, mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC][PATCH] cifs: Fix cifs_writepages_region() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2213351.1677249027.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable From: David Howells Date: Fri, 24 Feb 2023 14:31:15 +0000 Message-ID: <2213409.1677249075@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspam-User: X-Rspamd-Server: r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W ojlwR1f5 SFaa4aXygQGXryCcXkH3HvkJHO2ITXybkuDUgE9+jWB9oRGeVVfQXaykbpWVyfsv01NYYA85lGlcol1wWcSZzuw92NfrYOe/nczziI+RP+ucVWYdlCv4V/Oa9lArci3+d6uiXrBJIBco7+/PtQlk3DEjpCP3JmSUuimlQoqSFS1XpzL8yM3RneXoB7rkZ/ITfZCC7UKpRNXoeveqYzyN0KA7+DU2JyMiKBq2B99PdguPMC3OrwfmhpRC+qv2ByfjW73w+GuzFTqz+56gvS1kuXbyCS0fQmzR1ZxjBJFIW73bu+7B30Wt1MUFS8f5soNaDyGtDu7Qzih36knFZJjzz4tL0RHzOY6AQyJLyBZDFrZwJY57lHubeSvXH5w== 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: Here's the simplest fix for cifs_writepages_region() that gets it to work. Fix the cifs_writepages_region() to just skip over members of the batch th= at have been cleaned up rather than retrying them. I'm not entirely sure why= it fixes it, though. It's also not the most efficient as, in the common case= , this is going to happen a lot because cifs_extend_writeback() is going to clean up the contiguous pages in the batch - and then this skip will occur= for those. Fix: 3822a7c40997 ("Merge tag 'mm-stable-2023-02-20-13-37' of git://git.ke= rnel.org/pub/scm/linux/kernel/git/akpm/mm") Signed-off-by: David Howells --- diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5365a3299088..ebfcaae8c437 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2893,8 +2893,9 @@ static int cifs_writepages_region(struct address_spa= ce *mapping, = if (folio_mapping(folio) !=3D mapping || !folio_test_dirty(folio)) { + start +=3D folio_size(folio); folio_unlock(folio); - goto skip_write; + continue; } = if (folio_test_writeback(folio) ||