From patchwork Fri Feb 24 14:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 61344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp945705wrd; Fri, 24 Feb 2023 06:40:04 -0800 (PST) X-Google-Smtp-Source: AK7set88SmmDwIY+R8PXnaBl6F3f0x6aotY8OprwxX1NEaJ+yu/T0z5QtoDBCWu1VCZ3YXIO5Gy9 X-Received: by 2002:aa7:d718:0:b0:4ac:c029:ea72 with SMTP id t24-20020aa7d718000000b004acc029ea72mr15560860edq.36.1677249604516; Fri, 24 Feb 2023 06:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677249604; cv=none; d=google.com; s=arc-20160816; b=Jig4+HY6iUPN8mJSmE1X8DL6mmOkgTLGfAlc6qISOyf/FLiblOGHS/5NWGDfuXcpoQ DS97ShR0GVaF05Da4p6+qjVL7mRfDt3F7ZoVVCmeeZQLreXV5qvQ1YiQOMHOxNwO7Ocv XpQfioIT/ZFg58lqm+9iDK7J8UpAVZLWkWYC2sR8CV508d5MNRSsRO6qgetE174A4LbP ACV+iXBHDeQI7Tf824CY4Q7gyJdkP0hZ2tYIeSZoaAVIs59kQA9iMEcE/L5FxLibiaNH SskrwHtiFjZ9/t1YzxtJWtHM6NjUYSNwPyHs8QrNBYoqmRpod+swTkyB6WusRi829aZU icFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:from:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to :organization:dkim-signature; bh=SOsL6NM2MJym+f7C6hxVzCVTtD6Lm6OnQWKMhqCZjP8=; b=QnLuixezoeOQMnJ7EKBpGqyCDAeLQJzbg8IevqdljjW53wrYh9tuvR5Is8z+sQP9+h 2IYz6LfnA/21QuZOwu/bESHw4wx843RwLOXuuW0EPnqg4Ke9sRgNH3vLR0hJB8ERPscA sW1rZEzp1aLFg6BtA/bI1Rb97i/iRHYULXoRtl+3dKb8Nwd0BiFQDygGDrBlV9FxuaQM 836riUfwBjxSWG6LFAPykzoCM9Kqbgp8PrckYhRFwXQhsKhXo7jE0T/7aF2Jf02o3kK4 DGcKYSksznwoVBGSl/Wekb4MkD5NVvUHIO39Zn3IeuwP/IKw7wq79fSCYOz/JyEh40Sx a9jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ccpDWd7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020aa7c0cb000000b004ad0878cfd6si6717237edp.612.2023.02.24.06.39.36; Fri, 24 Feb 2023 06:40:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ccpDWd7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbjBXOcI (ORCPT + 99 others); Fri, 24 Feb 2023 09:32:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjBXOcH (ORCPT ); Fri, 24 Feb 2023 09:32:07 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE97B64E2E for ; Fri, 24 Feb 2023 06:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677249082; 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=ccpDWd7yzc9GIVUCggQrv/9t1lL/B2EmolBYSyptm3l5vSMYU+nX4DQuu4+G6/SrsBpv37 5hA59d9SmVA/xRgjvLgIt0jb/p/eea+xR5be5LtXvDYcVXq1RcqsJGOWvl6PxLNs7HK29H wOPZ9tpMWNpsp6oh33OBDlQ/d1+Izco= 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-ID: <2213351.1677249027.1@warthog.procyon.org.uk> 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758723681122184243?= X-GMAIL-MSGID: =?utf-8?q?1758723681122184243?= 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 that 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.kernel.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_space *mapping, if (folio_mapping(folio) != mapping || !folio_test_dirty(folio)) { + start += folio_size(folio); folio_unlock(folio); - goto skip_write; + continue; } if (folio_test_writeback(folio) ||