From patchwork Tue Jan 9 11:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514773 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 4A686C46CD2 for ; Tue, 9 Jan 2024 11:20:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D65506B0075; Tue, 9 Jan 2024 06:20:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEB496B007B; Tue, 9 Jan 2024 06:20:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B972A6B007D; Tue, 9 Jan 2024 06:20:51 -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 A47F76B0075 for ; Tue, 9 Jan 2024 06:20:51 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7C3D01A0358 for ; Tue, 9 Jan 2024 11:20:51 +0000 (UTC) X-FDA: 81659530302.15.2048C80 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id C1031A000A for ; Tue, 9 Jan 2024 11:20:48 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CSZTfwHx; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1704799248; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rr5EJ/KUtWAGcPxbo/TizcNZKdZiXnS9Nbdtw3WvDek=; b=yFjd+CTbV/kL3BtPDF0bdjNiObNAjguONASzuGDKwGkOh/vbL/NGH5LISmO7zymk9bgGoD EPKzQZEFk9SSz5dfs5znmzrcVD4gpC3TRFx07I3xSsQYfQFSedsjAEcyo0SgOC6d/ynwuw JhFaD0mA0ovDT7x6fab/lvwaUGqQNw0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CSZTfwHx; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799248; a=rsa-sha256; cv=none; b=tjgMMQRdo96V4BZ6CNMd5hZHXMDSnRcOj7fAIFGEGAjWTQe7HIlOdzSIzU2VNVmdIa1mod 5PMA6+8hbPuT1oDNStTG2+QYkK5fkQzxo05pyd62WiGzL2E/VSaZ8x4Z8mA4mJJlB55Lir l7/k8DE8xMlkT6hN9KffOV3IdZCR4NA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704799248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rr5EJ/KUtWAGcPxbo/TizcNZKdZiXnS9Nbdtw3WvDek=; b=CSZTfwHx1aUV+dSdXSXOq+K/hOBw8sJH3CgH4q+n5Uz8BTCr40ZKhh4Ot89JUhFF/W21h3 oauX3LmgtTlWgDoZro6soOVGq3xX6yQfwA+a396twgHGwxFl4A5IEGerlNc55SOqM+9oED sRf74Yu6Zh2Aa01OCXHBZEINzRC3YT4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-EIoi-qiVMCWdOvvkHaBtvw-1; Tue, 09 Jan 2024 06:20:43 -0500 X-MC-Unique: EIoi-qiVMCWdOvvkHaBtvw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59A0D29AA3A5; Tue, 9 Jan 2024 11:20:42 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E2DBC15A0C; Tue, 9 Jan 2024 11:20:39 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] netfs: Mark netfs_unbuffered_write_iter_locked() static Date: Tue, 9 Jan 2024 11:20:18 +0000 Message-ID: <20240109112029.1572463-2-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Queue-Id: C1031A000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: i69nhoxzg1k3wjinkqptzwggxwyqtis3 X-HE-Tag: 1704799248-193124 X-HE-Meta: U2FsdGVkX1+HbxFelC5q7CWLXbBN0xTysChejfDPNn0K1f+E+FdnmV4g/LhhjJBOpwioCrTgqKt+rI75mekqjlAe2DgeMFhNz/qj80aptHKpKUJLfKCY8ChOW/AOccPWJdZoirXIVGNDweC8/uyhrCUzJGSnp3wRrR9jsp35Oj+/+oM+T7Sq9t7kzbs/nnw7oY5WdZEfb/0NqJxAqSGwQzNVQTdbugFExamOAZFfJnyMCqWCb3gTgrhgkNB/GPLYH7VIQMkvJtE87m4zgRpXRsDtumYFnaAqxoM21P+E1P+Ig+kFgsC0DwyyuseUpgma2c1/6mIoq31EU7FTpoqtk1TStSleqYHQNWIhfSIkK7NCmFp0kGd7JM9MoZsVe6+MOsdRAIw3KWjI7jVQdGi5RTw3CfoKU7aj5weYNsnI2e8VbpjTwSsbVUws12W501laZiws46gdAog1m2COdswV18CQ62qTVkC3Uh6606vajyjR4uEv+lQ5iy9NHm2A8se2ji7n/F/uYgdAvCTxNn0MLjoLSmWK7voWePz45D8EnwDQH501P8cQnstqFpiNuxsbb12GOgJQF5+cYSehuxRsXzmgM7ebLY9j3jcop3EHEA5NOLwNG9Ih+Zh+mHjbFzQyClEeIq6fQgNZp9/MlkrrdN3f/Eiyyhf1MREasJuitMn5BqUP+koKBre+THW4V1Ja83+ofxq4d+ufPAq2jMMKkXNXki24rFKJrplD170aetgfaJ4my8vj0+6QAY0nldngFD/ioTHE4eJGZyGKcupnajvTZAok8lk8wH3Bvicf6D2MhBtUYQFZ4EUL/gHfdh+6W/PXi4dkPjo+DWpj/Wa37oRBN99Mq6MwygscdKzxa7dET18xmCYAHnWN3fRSi38BbtZlAK6664qobqZ/h1wjV7PI8Ph0CAMls2lxqKThelSdBjKoBV5X1gAxfvhxyef3wsnkjNKYuwDSPEUGwx3 6GfmiXx+ Eeo4zaZtUmCYKaqz0NUSx93hO15AFuC0a4EvrBch3m4kuwWuES4u1ARLscmXqL8qvWIKfPgHtFff3D5y7Ca+rxryh3a93OKRZ/U/ZTRoJYI/txCvgxLqgYt5wBhmt5t9R27a1A6Sa/oa3WfQHiHX8odaiOytfzDoFG+sDFOTUXu5fdxai56BgjXEr6gMKirJX0IAQMGIACgIujPvqNuJUnx+SKhC1Y1nC03Tw6cWfuVVTT/xkUq7YhgLpz4iyn9NDLYWZW4uwM0surb3Z//xds0qGUlYNTXQ8cyFboKA4gzRPHXAjmMu7pDiqAb0xHeMXbuVNQYhKeKBReXT7wT4k9Xogxw== 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: Mark netfs_unbuffered_write_iter_locked() static as it's only called from the file in which it is defined. Signed-off-by: David Howells cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/direct_write.c | 4 ++-- fs/netfs/internal.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index aad05f2349a4..b9cbfd6a8a01 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -27,8 +27,8 @@ static void netfs_cleanup_dio_write(struct netfs_io_request *wreq) * Perform an unbuffered write where we may have to do an RMW operation on an * encrypted file. This can also be used for direct I/O writes. */ -ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter, - struct netfs_group *netfs_group) +static ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter, + struct netfs_group *netfs_group) { struct netfs_io_request *wreq; unsigned long long start = iocb->ki_pos; diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index d2d63120ac60..a6dfc8888377 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -26,12 +26,6 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq); int netfs_prefetch_for_write(struct file *file, struct folio *folio, size_t offset, size_t len); -/* - * direct_write.c - */ -ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter, - struct netfs_group *netfs_group); - /* * io.c */ From patchwork Tue Jan 9 11:20:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514774 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 F0236C47077 for ; Tue, 9 Jan 2024 11:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 416226B007B; Tue, 9 Jan 2024 06:20:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5D06B007D; Tue, 9 Jan 2024 06:20:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 265906B007E; Tue, 9 Jan 2024 06:20:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 10E5A6B007B for ; Tue, 9 Jan 2024 06:20:53 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CFCC680821 for ; Tue, 9 Jan 2024 11:20:52 +0000 (UTC) X-FDA: 81659530344.04.F87A562 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 18D43100014 for ; Tue, 9 Jan 2024 11:20:50 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R3VTb3bz; spf=pass (imf14.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=1704799251; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WPQwieeKN1qerHU6y651BO8nE/WRIhipjKm0fUBOfew=; b=nIzD6BlxXhLHiwrWXrIM9z6IkVyAp9knu3LG+3tmQiwLcIs5vjsZ/BaLaRJ8jEBAX8p/Xd EmzO/jd3iYOwBWXgeWv1jvtHKdnlEqR53MIHCAD8uAHfOdTsAA7VcPOB85flMwQFm2vCok 1tjgP/EDSj62PCB5Wfpf+tZeR1jHYNc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799251; a=rsa-sha256; cv=none; b=WP5VDJb2BSxq+m4xSoH+ga90blA10wO10YCmtn0zcEzrzhuEvkcPLc4vjFj6Au4T9xUz/N ETu8UB/a4HGrsnzGC2QDT+qFJhgUncIesxkKkQSuBwyjkArkXAgoEPd9M06O/+hgO80oS2 ToaIZAJeBUZNXvu43GGuTACxZdKQ4kA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R3VTb3bz; spf=pass (imf14.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=1704799250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WPQwieeKN1qerHU6y651BO8nE/WRIhipjKm0fUBOfew=; b=R3VTb3bzmbJbL71/d+R4gAaxr+hH5lJ2v0RJfgg4lv5yS+Kvf+SmDdljSBW5twgE5xDm01 4V9rJrXNwE5j/Q0F18D9Y1WTBAHSdGDjW1ym/wGOKUBxYuLPHiM2kiCfo+gpn/Hmy6ZQn1 fOA5PJ8IRD+sQv8TBrfPKox49PnDfHk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-E31DJX2lMH602RvDfJCjMg-1; Tue, 09 Jan 2024 06:20:46 -0500 X-MC-Unique: E31DJX2lMH602RvDfJCjMg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3D56811E86; Tue, 9 Jan 2024 11:20:45 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C7D83C39; Tue, 9 Jan 2024 11:20:42 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] netfs: Count DIO writes Date: Tue, 9 Jan 2024 11:20:19 +0000 Message-ID: <20240109112029.1572463-3-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspamd-Queue-Id: 18D43100014 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: k4gbfs835a38389iftasyp7pgz6yn4rh X-HE-Tag: 1704799250-778792 X-HE-Meta: U2FsdGVkX195ohzUzV+JH2/VSQI7PJ+1rk09x6odbrMrzsTWDFOTEt60otCqNYYtEAO4zsde8gUp8OvJj44MZwCifEQqgcjQA/Ldl6Y1ZgWb/zFEAfRxnLae737I+CQoQxTaZIKjSUfN3VZLU3CjQ7mmOY/BCMgFC7NM0BPo/8Dk32YP6EIUxQpvi7qeIOFR+WBt6cxISCx4Q7WPVW40WjoTG8VO5EcPRGcVRks3GhGg5HiuaJ31gUvWrwJDAjH8sgqKgD+FzPS0qsYHsvmNSk2eNjXVm/0VardWDjNTVZ0zX0eJmFtSy9/rbJSg2hBBJXxHWGWYuz0Aqc7pFFdFOnW97SGwrCWON9CAfYiAKuk4F5OlYyDRJW7+ivQyhijkfy4RgIHg/VJ3cPfV1Ap2+D52bbnTGVceHR/bMxdiOKp0SbIFtf0l4na0u/37GmJeRXe5UBbTXQ0K1BTXezXXhAZK2icB1iqrnzTqek5/l0/+uVo5pcWp8EHmB+11dNo3LuzRXJXPAgtV5Iope+LLL4JQv4yUbLZLgAX7ZM6wDIGw7t6LxKgKLOAJMTM6ff9vk5PNlD2Ht9lhfL4jg93Txg3FR3txFFFZW91TKS8TDQFjPqgg3nVJLAfcua7uCIZ4qLweeqVYqdq18G7U79gNLEagRlhXRe9/6O8cPD+RItsGdWKHBXnAQ8+g/XYJ1kubzXVkQzIjMUX+eL22OJz6/N9x2WKjnlQ2aDdm2lZkLJ59L3fYRq2WBEqOiE5IX2gPCfEz8kHMhARSVAObI1d3F/LBsOjDLglflRfvugzi6Q+VcrR1lksMsj+rQF8hvEgCwHTrN0a05ksMkn/R9hWE4Thp8lVxRnKaUukVkJlMJY4gC/DNOF8PKFrcKJPE4tKjAchp0YE075gbZ1RUcE+U7WmXIKRwEFtIXzsjc30nNS7AAOwR1M6sFC3ERQjWr68iChYpivwOLusPzGd80FJ pIitp7B/ iVX65gFS//Q/QQRWprR30lcpId45ci6BhB2tJT+/vJQ0ro528IIPyEAiUCuz3hv0PnrIzkdpQhgbXPIQEyqdXNG6K4pUXHwDqAV43z1OrFJ33hlxFks7ak7EdEwpNYs0UnjfJBQunjH56G1pkVgTa3KGPuBu6UYy19qBN2WKAe5CfBL7vzW6v421Nr9TFG8bG4mO8R3bP9Gl4eePMBIauLyPJb/aH0tcHMa8xz19UDeAw98zsn2ZkDTqSUhXmiYyn4FeIO810d7Y/5ztk/k4g9+GRnE/SzqwSX/XS148+fLbXMnk= 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: Provide a counter for DIO writes to match that for DIO reads. Signed-off-by: David Howells cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/direct_write.c | 1 + fs/netfs/internal.h | 1 + fs/netfs/stats.c | 11 +++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index b9cbfd6a8a01..60a40d293c87 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -140,6 +140,7 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from) _enter("%llx,%zx,%llx", iocb->ki_pos, iov_iter_count(from), i_size_read(inode)); trace_netfs_write_iter(iocb, from); + netfs_stat(&netfs_n_rh_dio_write); ret = netfs_start_io_direct(inode); if (ret < 0) diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index a6dfc8888377..3f9620d0fa63 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -104,6 +104,7 @@ int netfs_end_writethrough(struct netfs_io_request *wreq, struct kiocb *iocb); */ #ifdef CONFIG_NETFS_STATS extern atomic_t netfs_n_rh_dio_read; +extern atomic_t netfs_n_rh_dio_write; extern atomic_t netfs_n_rh_readahead; extern atomic_t netfs_n_rh_readpage; extern atomic_t netfs_n_rh_rreq; diff --git a/fs/netfs/stats.c b/fs/netfs/stats.c index 15fd5c3f0f39..42db36528d92 100644 --- a/fs/netfs/stats.c +++ b/fs/netfs/stats.c @@ -10,6 +10,7 @@ #include "internal.h" atomic_t netfs_n_rh_dio_read; +atomic_t netfs_n_rh_dio_write; atomic_t netfs_n_rh_readahead; atomic_t netfs_n_rh_readpage; atomic_t netfs_n_rh_rreq; @@ -37,14 +38,13 @@ atomic_t netfs_n_wh_write_failed; int netfs_stats_show(struct seq_file *m, void *v) { - seq_printf(m, "Netfs : DR=%u RA=%u RP=%u WB=%u WBZ=%u rr=%u sr=%u\n", + seq_printf(m, "Netfs : DR=%u DW=%u RA=%u RP=%u WB=%u WBZ=%u\n", atomic_read(&netfs_n_rh_dio_read), + atomic_read(&netfs_n_rh_dio_write), atomic_read(&netfs_n_rh_readahead), atomic_read(&netfs_n_rh_readpage), atomic_read(&netfs_n_rh_write_begin), - atomic_read(&netfs_n_rh_write_zskip), - atomic_read(&netfs_n_rh_rreq), - atomic_read(&netfs_n_rh_sreq)); + atomic_read(&netfs_n_rh_write_zskip)); seq_printf(m, "Netfs : ZR=%u sh=%u sk=%u\n", atomic_read(&netfs_n_rh_zero), atomic_read(&netfs_n_rh_short_read), @@ -66,6 +66,9 @@ int netfs_stats_show(struct seq_file *m, void *v) atomic_read(&netfs_n_wh_write), atomic_read(&netfs_n_wh_write_done), atomic_read(&netfs_n_wh_write_failed)); + seq_printf(m, "Netfs : rr=%u sr=%u\n", + atomic_read(&netfs_n_rh_rreq), + atomic_read(&netfs_n_rh_sreq)); return fscache_stats_show(m); } EXPORT_SYMBOL(netfs_stats_show); From patchwork Tue Jan 9 11:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514775 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 CEEE4C46CD2 for ; Tue, 9 Jan 2024 11:20:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63A0D6B0080; Tue, 9 Jan 2024 06:20:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C0D26B0082; Tue, 9 Jan 2024 06:20:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43A726B0081; Tue, 9 Jan 2024 06:20:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2FF566B007E for ; Tue, 9 Jan 2024 06:20:57 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EF4D940898 for ; Tue, 9 Jan 2024 11:20:56 +0000 (UTC) X-FDA: 81659530512.28.B9B55DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 614E320024 for ; Tue, 9 Jan 2024 11:20:55 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fiVdWrZd; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.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=1704799255; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fR5jKaj4zqBjWF982EotHFYbvpWpLhYokRvcwfgk5DQ=; b=Pt7Qf3sfQAdRCILMBhFnDYSVi6aB8R6dk7pBaUA0RP+pniZOe6YrJZ74JguxVmvLmVl9s6 G0nCPc8+yOFqgPXnIrX45++hSqkHGk5wCFrLHJPOHvvS4enH5vLU/knbrU894qWIlxUdlh AsJraqaefJDPEvBIY6J9fjQjaNj+6Lk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fiVdWrZd; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.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=1704799255; a=rsa-sha256; cv=none; b=WKlIn2aDnT8MKmqewjZsff/s4xu+jBce3EJbFnWIk+DeVqk9//FfWIX9yBM8SiJbafnpEA mADEPg12Jrqq+u1M6FO3KonB63UEapycUPGDU4bVmNkOYpi0OlRdlbsKy9NZg7SsuyIWA8 QUm75TQvj0ZnLrGeGkODocF+58h4osQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704799254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fR5jKaj4zqBjWF982EotHFYbvpWpLhYokRvcwfgk5DQ=; b=fiVdWrZdLXkb7JIHV0Wie2dNfRXQ+ywGwZC0V7sL11fodLPfXj1TDquR9eCmV3OT703w1p lTrV4ShcXQf0R4hLoH4dGrIrQmxHAwd/tXpUk1eyQY8RvCDaahZjf5SedHrhh6eksEdD9P xp6p8/6LdI77E9OiaPxd45w7I3Cd7iY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-Gs55spOOMJaH-_bIsqDWkA-1; Tue, 09 Jan 2024 06:20:50 -0500 X-MC-Unique: Gs55spOOMJaH-_bIsqDWkA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7AF6629AA3A5; Tue, 9 Jan 2024 11:20:49 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93EA31C060B1; Tue, 9 Jan 2024 11:20:46 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] netfs: Fix interaction between write-streaming and cachefiles culling Date: Tue, 9 Jan 2024 11:20:20 +0000 Message-ID: <20240109112029.1572463-4-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 614E320024 X-Stat-Signature: onzp3idjxt8ztyee5qcb97knq44wm9x1 X-HE-Tag: 1704799255-849592 X-HE-Meta: U2FsdGVkX18X+T9fg9WR3yF6Zjz7oX/u/v/JpRuk1RmHWtVB7QdEAMzFSPQ//d8weidaQBKU44zi16B/kZ6westt1CaNn9o/w6BBFBFlKTaJtKkybLYUOx7QLlsyDsg3uq6zbP0O7haI0jhBVTM8NwNi/lFPaRDU9eIXbcilDZurkctX3PfJfApaaHADgwORV/7VdVBWVcnsJW/lotgZG4G292diuBf8WOBjyKzwAtMcPegvG0+LBxQlt9PAyGbh4EMN2PwzERSsJdeKUBg6RWPBl4gN6NjU9eSEEMhFUVYQPxTBZA6sX1nA7RqYxgB3szgL5Z93rc0kJ/Bi6ecSM38iTc8LjCeiFzE2M9WFaOc3N0Qx9KYyh838SEiU+r3IXf1P6H8M6ECUubbN1mlfP3KASsWDEQryLht04XdqyTWsxFsn2tBpr79JKdvq9KZIhSlzW+5jF10b8gy6r+YKJ//GKjQzowwX++06lFVRdvIrAMjP4KyB++IvPy5Ek16bAcBdzMW0okVjVfDeqjTE6AK5SQAQ8Q23VdszgJ63+XlQh9IVg+vfP4hu/x3XceeuJ1XgySVhS1SyhPPbuqHfCayE4gps85bo81aNIZ3xWeDJzgt2+GY7tm9FQSmMwirZKqJlEQz+1oLlxLBzlISG+gOdPFtc2xJK3UGIA9fYz7ZWpV2ohUvnY3IH0gKJEOWQlEa3RK2QeUmE+/z4w8YIA9z8zY/QXL9iGbImQ7GWiRRAzDKHQaC30P9/Dk53yFRLTXnvtAwXFgUrOjbA4Q7jWlX3DgT0C5zbMVAHYghHm45rOYTGe3GKMmlVCtVjSspQ/2NQYe9J+hnUTj/WfT2RUjnwMwyfSQw7WQz7Rh0Rt7/K5oo7Fscm5PL9HG7HE2U2G2ql7sHZbVe2UNN9rdn27w== 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: An issue can occur between write-streaming (storing dirty data in partial non-uptodate pages) and a cachefiles object being culled to make space. The problem occurs because the cache object is only marked in use while there are files open using it. Once it has been released, it can be culled and the cookie marked disabled. At this point, a streaming write is permitted to occur (if the cache is active, we require pages to be prefetched and cached), but the cache can become active again before this gets flushed out - and then two effects can occur: (1) The cache may be asked to write out a region that's less than its DIO block size (assumed by cachefiles to be PAGE_SIZE) - and this causes one of two debugging statements to be emitted. (2) netfs_how_to_modify() gets confused because it sees a page that isn't allowed to be non-uptodate being uptodate and tries to prefetch it - leading to a warning that PG_fscache is set twice. Fix this by the following means: (1) Add a netfs_inode flag to disallow write-streaming to an inode and set it if we ever do local caching of that inode. It remains set for the lifetime of that inode - even if the cookie becomes disabled. (2) If the no-write-streaming flag is set, then make netfs_how_to_modify() always want to prefetch instead. (3) If netfs_how_to_modify() decides it wants to prefetch a folio, but that folio has write-streamed data in it, then it requires the folio be flushed first. (4) Export a counter of the number of times we wanted to prefetch a non-uptodate page, but found it had write-streamed data in it. (5) Export a counter of the number of times we cancelled a write to the cache because it didn't DIO align and remove the debug statements. Reported-by: Marc Dionne Signed-off-by: David Howells cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-erofs@lists.ozlabs.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/cachefiles/io.c | 12 ++++++------ fs/netfs/buffered_write.c | 24 ++++++++++++++++++++---- fs/netfs/fscache_stats.c | 9 ++++++--- fs/netfs/internal.h | 1 + fs/netfs/stats.c | 6 ++++-- include/linux/fscache-cache.h | 3 +++ include/linux/netfs.h | 1 + 7 files changed, 41 insertions(+), 15 deletions(-) diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c index 7529b40bc95a..3eec26967437 100644 --- a/fs/cachefiles/io.c +++ b/fs/cachefiles/io.c @@ -528,12 +528,12 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, /* Round to DIO size */ start = round_down(*_start, PAGE_SIZE); - if (start != *_start) { - kleave(" = -ENOBUFS [down]"); - return -ENOBUFS; - } - if (*_len > upper_len) { - kleave(" = -ENOBUFS [up]"); + if (start != *_start || *_len > upper_len) { + /* Probably asked to cache a streaming write written into the + * pagecache when the cookie was temporarily out of service to + * culling. + */ + fscache_count_dio_misfit(); return -ENOBUFS; } diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 08f28800232c..6cd8f7422e9a 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -80,10 +80,19 @@ static enum netfs_how_to_modify netfs_how_to_modify(struct netfs_inode *ctx, return NETFS_WHOLE_FOLIO_MODIFY; if (file->f_mode & FMODE_READ) - return NETFS_JUST_PREFETCH; - - if (netfs_is_cache_enabled(ctx)) - return NETFS_JUST_PREFETCH; + goto no_write_streaming; + if (test_bit(NETFS_ICTX_NO_WRITE_STREAMING, &ctx->flags)) + goto no_write_streaming; + + if (netfs_is_cache_enabled(ctx)) { + /* We don't want to get a streaming write on a file that loses + * caching service temporarily because the backing store got + * culled. + */ + if (!test_bit(NETFS_ICTX_NO_WRITE_STREAMING, &ctx->flags)) + set_bit(NETFS_ICTX_NO_WRITE_STREAMING, &ctx->flags); + goto no_write_streaming; + } if (!finfo) return NETFS_STREAMING_WRITE; @@ -95,6 +104,13 @@ static enum netfs_how_to_modify netfs_how_to_modify(struct netfs_inode *ctx, if (offset == finfo->dirty_offset + finfo->dirty_len) return NETFS_STREAMING_WRITE_CONT; return NETFS_FLUSH_CONTENT; + +no_write_streaming: + if (finfo) { + netfs_stat(&netfs_n_wh_wstream_conflict); + return NETFS_FLUSH_CONTENT; + } + return NETFS_JUST_PREFETCH; } /* diff --git a/fs/netfs/fscache_stats.c b/fs/netfs/fscache_stats.c index aad812ead398..add21abdf713 100644 --- a/fs/netfs/fscache_stats.c +++ b/fs/netfs/fscache_stats.c @@ -48,13 +48,15 @@ atomic_t fscache_n_no_create_space; EXPORT_SYMBOL(fscache_n_no_create_space); atomic_t fscache_n_culled; EXPORT_SYMBOL(fscache_n_culled); +atomic_t fscache_n_dio_misfit; +EXPORT_SYMBOL(fscache_n_dio_misfit); /* * display the general statistics */ int fscache_stats_show(struct seq_file *m) { - seq_puts(m, "FS-Cache statistics\n"); + seq_puts(m, "-- FS-Cache statistics --\n"); seq_printf(m, "Cookies: n=%d v=%d vcol=%u voom=%u\n", atomic_read(&fscache_n_cookies), atomic_read(&fscache_n_volumes), @@ -93,8 +95,9 @@ int fscache_stats_show(struct seq_file *m) atomic_read(&fscache_n_no_create_space), atomic_read(&fscache_n_culled)); - seq_printf(m, "IO : rd=%u wr=%u\n", + seq_printf(m, "IO : rd=%u wr=%u mis=%u\n", atomic_read(&fscache_n_read), - atomic_read(&fscache_n_write)); + atomic_read(&fscache_n_write), + atomic_read(&fscache_n_dio_misfit)); return 0; } diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index 3f9620d0fa63..ec7045d24400 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -123,6 +123,7 @@ extern atomic_t netfs_n_rh_write_begin; extern atomic_t netfs_n_rh_write_done; extern atomic_t netfs_n_rh_write_failed; extern atomic_t netfs_n_rh_write_zskip; +extern atomic_t netfs_n_wh_wstream_conflict; extern atomic_t netfs_n_wh_upload; extern atomic_t netfs_n_wh_upload_done; extern atomic_t netfs_n_wh_upload_failed; diff --git a/fs/netfs/stats.c b/fs/netfs/stats.c index 42db36528d92..deeba9f9dcf5 100644 --- a/fs/netfs/stats.c +++ b/fs/netfs/stats.c @@ -29,6 +29,7 @@ atomic_t netfs_n_rh_write_begin; atomic_t netfs_n_rh_write_done; atomic_t netfs_n_rh_write_failed; atomic_t netfs_n_rh_write_zskip; +atomic_t netfs_n_wh_wstream_conflict; atomic_t netfs_n_wh_upload; atomic_t netfs_n_wh_upload_done; atomic_t netfs_n_wh_upload_failed; @@ -66,9 +67,10 @@ int netfs_stats_show(struct seq_file *m, void *v) atomic_read(&netfs_n_wh_write), atomic_read(&netfs_n_wh_write_done), atomic_read(&netfs_n_wh_write_failed)); - seq_printf(m, "Netfs : rr=%u sr=%u\n", + seq_printf(m, "Netfs : rr=%u sr=%u wsc=%u\n", atomic_read(&netfs_n_rh_rreq), - atomic_read(&netfs_n_rh_sreq)); + atomic_read(&netfs_n_rh_sreq), + atomic_read(&netfs_n_wh_wstream_conflict)); return fscache_stats_show(m); } EXPORT_SYMBOL(netfs_stats_show); diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index a174cedf4d90..bdf7f3eddf0a 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h @@ -189,17 +189,20 @@ extern atomic_t fscache_n_write; extern atomic_t fscache_n_no_write_space; extern atomic_t fscache_n_no_create_space; extern atomic_t fscache_n_culled; +extern atomic_t fscache_n_dio_misfit; #define fscache_count_read() atomic_inc(&fscache_n_read) #define fscache_count_write() atomic_inc(&fscache_n_write) #define fscache_count_no_write_space() atomic_inc(&fscache_n_no_write_space) #define fscache_count_no_create_space() atomic_inc(&fscache_n_no_create_space) #define fscache_count_culled() atomic_inc(&fscache_n_culled) +#define fscache_count_dio_misfit() atomic_inc(&fscache_n_dio_misfit) #else #define fscache_count_read() do {} while(0) #define fscache_count_write() do {} while(0) #define fscache_count_no_write_space() do {} while(0) #define fscache_count_no_create_space() do {} while(0) #define fscache_count_culled() do {} while(0) +#define fscache_count_dio_misfit() do {} while(0) #endif #endif /* _LINUX_FSCACHE_CACHE_H */ diff --git a/include/linux/netfs.h b/include/linux/netfs.h index d3bac60fcd6f..100cbb261269 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -142,6 +142,7 @@ struct netfs_inode { #define NETFS_ICTX_ODIRECT 0 /* The file has DIO in progress */ #define NETFS_ICTX_UNBUFFERED 1 /* I/O should not use the pagecache */ #define NETFS_ICTX_WRITETHROUGH 2 /* Write-through caching */ +#define NETFS_ICTX_NO_WRITE_STREAMING 3 /* Don't engage in write-streaming */ }; /* From patchwork Tue Jan 9 11:20:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514776 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 08A6AC46CD2 for ; Tue, 9 Jan 2024 11:21:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E0FB6B0082; Tue, 9 Jan 2024 06:21:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9698D6B0083; Tue, 9 Jan 2024 06:21:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 831046B0085; Tue, 9 Jan 2024 06:21:03 -0500 (EST) 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 6E71B6B0082 for ; Tue, 9 Jan 2024 06:21:03 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 47BAD408A1 for ; Tue, 9 Jan 2024 11:21:03 +0000 (UTC) X-FDA: 81659530806.18.368C28D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 90A851A000C for ; Tue, 9 Jan 2024 11:21:00 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aVUMHiOn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1704799260; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v9Zmt8qPNtA4BbCqgJuw0LKGT28DtGNcpxFrcZYWG/0=; b=FIF0nEocgkMmlIAzoBXwbheEhRfj/lqggKVYhFXTxkMq/CXnq2v77fNIUe6wJbYM3sVesg dGXCogFTmoOJ976e26h/wOqWdlLVf3N7zBzkxFKFO9P12xANScICu+53HIxsFRC9bbkdMH /63SjhbkijGINI6Ikj1cjIYlSlPQVak= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aVUMHiOn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799260; a=rsa-sha256; cv=none; b=DdsvT4D2MXT8aQud1GTp/DjrsexwmYplRR/xFyXTjiYVzeoY/LCNc1AGCbwpiXSDdBFOH1 c8NY4l1bvjPTpQASh7oxfmuEkPotICpnOqT6HrKdwN2gDHREjLh6BNNVqDY5v4tovDEzR4 VeMupUy99whDruBkqOF6007Wt3v9DTg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704799260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v9Zmt8qPNtA4BbCqgJuw0LKGT28DtGNcpxFrcZYWG/0=; b=aVUMHiOnlSkkNxAoRTJTrLF5vnYjH08buM8p0vjG348ozn+JK8h6ceD3RHiTG7kG3X/w86 V9PMUpqzfL8nRY/ZlbXJ2dw+EsnGEM+j4GZgCRKWdrQlp9upRZSzXehz1q3QUVYxjOJ7bH 6Mc+DGQmv/ZfT9iW8M3ku4pmDUVnM3U= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-aZtDJMnWPAi-V2MIXSUMUQ-1; Tue, 09 Jan 2024 06:20:54 -0500 X-MC-Unique: aZtDJMnWPAi-V2MIXSUMUQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28F8329AA3AF; Tue, 9 Jan 2024 11:20:53 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CD382166B32; Tue, 9 Jan 2024 11:20:50 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] netfs: Fix the loop that unmarks folios after writing to the cache Date: Tue, 9 Jan 2024 11:20:21 +0000 Message-ID: <20240109112029.1572463-5-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 90A851A000C X-Stat-Signature: zzsndrw8xtrr1qgp9gj3ctf8ci4o9fht X-Rspam-User: X-HE-Tag: 1704799260-604725 X-HE-Meta: U2FsdGVkX1/yx9Gw4GuVcnEqEUZrS51gichsPUiyV3vNrUSQPg+6eZFAyPLtMQ9FTyn3nenZq5/lgXTNgLKTQciDDbp91jCjj3kHYK12ZDsYkIBWtV/eBhY8YKGInW6nVPaxyLbuY2eXpcV3IaZksrkPTzEIpsZi+xRcs7nBjxYrx/oTTkdMpcXnjofCN+zAetitgjU35Slr6OWWJjPfk4Y/eZ2mxYbHWWhEVQoTD2wso83M3NEdduJx4SO5uchb1z4mQMm+eRq0QzMr+I4KWqELUqmyXs44L8DrVQWHzxiKp9MZoeHjXVRjHgPkc2DKBtkKt3S7ucGX7npSEQRNm3Ras210hqaJXq5btBWdFWDow0AL3MaHsfHz2GZcqg/VyFU96AN3cXEvnHZV/ShwMDclaXW4d+bBZ906XxC1/v0zAKxY/Q7yGM0lUqpbv8ESEhRuGPs6VQnfhe72f75ziR3VDArJAhLWffLmb52kBDtmmL/9ZXxhXA8zrgg9uU81RM5aLMMSRh9ByRhqmFpjCwMXCUkLiXbdwLyiu4LG8EJ5iNYQO8Y/S6NDi4PTIZmBCPdNoNBVfEPLqesCGmFtL9R+VHazR3MmQWhj7TDGULhEQe4iNlVX/UAJ7/z81rtbRpRc8Y0rvOXkt+eJfGXwMd20pfB/o3I3TEbl7wtjb2OX2UNLeFSSZVdozdJfSwPW5sxuKW7aVDD3yHNuV2CChS8FIRl/o216znUBOsaCP9Y8x/OhCDDur19EXPbqufQxiEwY8ZsyyBu7IUw6utuRdkim417iLGmDxsOfddaZWahrsqrbErvSVinptUXfidApHaMg1X7dTnoOOKX8/+ryQwyeHdn+T4rEz+G4fI+6g2kWZj6XSH+zkapWyzUJtCMaaypkUzO+bSSjvOLBqxypKsEcT66Veur1y4Jz+rl535xrf8M4puCUVP7JuXzp1J+Pqd0qkU/UTn2AWq4z+jJ p2xKoLpO Mu5q1tqgY6yb4BZZvU2Fa52i2hEMjQvfvMmpnXBVBqFfiOakKdV8XXjx6w/8X8tBev5xGoDDH3XIDe2HhL01rYd++oEVUeCPgi4hCigUWqxzW2zepeEjdlj5CB1csAieoHeG3m7cdlSLXXtksiwj1N3xCB0x7TzX3s1p8yvW7pofqRjyksnKaO/qFZoEF9WLSXAx2yGmq4E16tzXWCA/vNFjflDKfwSzIZU/EpUi2nUV8o15k0RIwyAXSjeKS/XegvWrhKIXIsXa5hhGEJi0cIfUunq6wO9cewsl1Qp5jng7OZeSBbtTyuLgRjr1Mpu6CergAgcVgfWyRTjyLinKYG7GkEfr0AGdUQ5vNS0KqBGrUsSQal7EAvV+yiYQ+A7sM9Ea5j16YLIQ01OU64Lds1inlqArn4LUyAils 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: In the loop in netfs_rreq_unmark_after_write() that removes the PG_fscache from folios after they've been written to the cache, as soon as we remove the mark from a multipage folio, it can get split - and then we might see a fragment of folio again. Guard against this by advancing the 'unlocked' tracker to the index of the last page in the folio to avoid a double removal of the PG_fscache mark. Reported-by: Marc Dionne Signed-off-by: David Howells cc: Matthew Wilcox cc: linux-afs@lists.infradead.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/buffered_write.c | 1 + fs/netfs/io.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 6cd8f7422e9a..0b2b7a60dabc 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -698,6 +698,7 @@ static void netfs_pages_written_back(struct netfs_io_request *wreq) end_wb: if (folio_test_fscache(folio)) folio_end_fscache(folio); + xas_advance(&xas, folio_next_index(folio) - 1); folio_end_writeback(folio); } diff --git a/fs/netfs/io.c b/fs/netfs/io.c index 5b5af96cd4b9..4309edf33862 100644 --- a/fs/netfs/io.c +++ b/fs/netfs/io.c @@ -126,7 +126,7 @@ static void netfs_rreq_unmark_after_write(struct netfs_io_request *rreq, */ if (have_unlocked && folio_index(folio) <= unlocked) continue; - unlocked = folio_index(folio); + unlocked = folio_next_index(folio) - 1; trace_netfs_folio(folio, netfs_folio_trace_end_copy); folio_end_fscache(folio); have_unlocked = true; From patchwork Tue Jan 9 11:20:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514778 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 7699EC47077 for ; Tue, 9 Jan 2024 11:21:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7BCB6B0087; Tue, 9 Jan 2024 06:21:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF0FC6B008A; Tue, 9 Jan 2024 06:21:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8319D6B0088; Tue, 9 Jan 2024 06:21:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 650C16B0087 for ; Tue, 9 Jan 2024 06:21:10 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 36EAFA1D46 for ; Tue, 9 Jan 2024 11:21:10 +0000 (UTC) X-FDA: 81659531100.13.EF3E9D9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 69AC84001A for ; Tue, 9 Jan 2024 11:21:08 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aenuw9aH; spf=pass (imf04.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799268; a=rsa-sha256; cv=none; b=gpESshsUih65Wkt6CfZwt88Km/RFmhUO3nXlsRzBndl6EmbxJ2YDvVNBf5F7Wo30N8RQvX cqBN+bcjuTG2fhNbq8u3cQ4lLoQpgqvHSyo+30dA2SABay591sVPQ2KVpi7ZAKcBFXZbgt LjijOQOcRkxr34xlBO5nXZlH8vMdQjo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aenuw9aH; spf=pass (imf04.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=1704799268; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z0xNWJpdRPanEuZiAQenKRA87zeZrifRwyW7XU8kxYA=; b=8kzfORCV/I0ciRh8KGOHBR4TlyAK10wEtuxosaTV2Wvy3n28QQNPmC9pdOSxFkjCClQ626 oDIKwIJnrO0bXIOaxVV+us0YdFu7GdtuljcUJsnKn//vnbrm36nMoo5MWrgAkjJOzqvY5G cWXr0L8AH2dT9MvWzuxA1Run75RYnRc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704799267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0xNWJpdRPanEuZiAQenKRA87zeZrifRwyW7XU8kxYA=; b=aenuw9aHRQL27VHKd8TZIUSzbuPzLvSAP9TxWUqXC8oonOoFJfjVmemuzi47tyWRK+FHh4 Aez8xm0OjtWMefvNnRfEsTLtKLFWIXCz6hEHPNVAX8dwZgsfpW6XKfYiCuzF9zalX3UEen nJV7R85qms2x4mFwd1ttema+GEAaoh4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-581-EPXp23K5MHONs8COTGeLaw-1; Tue, 09 Jan 2024 06:20:58 -0500 X-MC-Unique: EPXp23K5MHONs8COTGeLaw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 357C31C06505; Tue, 9 Jan 2024 11:20:57 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id C71151121306; Tue, 9 Jan 2024 11:20:53 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , kernel test robot , Yiqun Leng , Jia Zhu Subject: [PATCH 5/6] cachefiles: Fix signed/unsigned mixup Date: Tue, 9 Jan 2024 11:20:22 +0000 Message-ID: <20240109112029.1572463-6-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 69AC84001A X-Stat-Signature: 3k5ri7sxsg6peghfhacytrour1bctk78 X-Rspam-User: X-HE-Tag: 1704799268-756376 X-HE-Meta: U2FsdGVkX1/KlHJKHbOexkNYddTCFuZ5vZQWYQ0WTPs+4iEDITFLydx5ryemuJpu8iQV+DlbHGlu5mF/5aZrAFtVHGMl8TBC1u/mODxHuiBPuFizArPbWnOwziR6SQrntlWLtwMGI99Q0zbhIg9jpkpB0tlWMVPO8SJYwLt4Mb45FUBzFYryYZ+cVq/+XXqykgbIW23K7G0P+LAuNUr9ziaV0vc1w8eSTEjgU5BWiHDmE2NUJUOtJIsMSS3FS7k9xEYCxUy9tCavLs1r+DQt/5Mv9EX1dcPqwQBnfPWBpNZegWFvlsvUOGvYxW8gH6FlSu6Qa8aDEkyunMM+N+Fbom9lzjUsoCNNLh/OBhmPW7KrKOT9eajg+9b3pOeGIdBX9Ic9IBywTiImDPN2C4SejntGqUSdA/HzbeCdQmTh5KEvpICDAt0g4ts36DLX9H34IIhreGH0xAQOSBiOlJIdcqL4vn2sThYqG5cIzBfGuWleVlzIngi2Qn8bcO8I52CBuztnk8IYJtyH5J4XOnCUZfgHuvwEioWmzrGZF3vwojePOZNIihThoKBNy/ZKnK5zdoJhYm+WP1wVbvOQ0wTH6jr93uFWiGuL1uwWPsKfcQS2jLs59d5EI4Hn90kvpZHRVV8HkqE565IqriBs1/UgRE3v4OSRn/0InJq6u2DcNkBHWqcK7/lRo3w09RxvqWaFHO+8aES/84WybV8HAeyWkSxjCA5NlpPrtfNfXTfiQ8fP6GGkJHD8Xqd4YYw8UWlobif3TNTrV/xKA9YNR7vi8QuZ81C/XhJEeWTSm+mU1uLj6J/5MbIkRbgN0KHY6G1zDwAbvW9Uqq2XqcVCGKHAJ488RGJafKrqDI9kHHC+fCDHX5DsrVopS6wlnLDTKLkLBr8KFUBif50aefFeIHCHnqpkqnwEDIGEtJY2Bb8ZU9dghXZnFBUczK1jaema5+m9/oZl3c3IXmUImuGkW/I PGQZmRUO fxLzUCu/WQE5klRqQZrJpdWY+eUnvRzkgSph7HL/M27RM0Jl2pUTqXJbd/txJUts1wmLviDSVdLpSuRbEcAmBLOuJjkepvennX+ZUxnEqO4U6GjY7YghskLGjUbuE27ahbiQPfjLfmJvTI40wIZw3A8VPOaz/CpXnHh5bAJzQSko/yVgbdYkiHiaseNdRIK0w1RAOy3Ev7o7vAfweNvaadtT2kuanXNAC49YN6pEWcpeJ5TVfD/UCd1ooYTscwCbTNHUatcazCLdG9pNLjhxIWpklFkTZ89liyJdwSYRWEXAvmoV6DbytywJ2cTrAwPIwuSRMkjUu8KGh1pDufb5Ketgu06B8c6vpk3pCynsxkO6AndfMmQ3D9Nfzp0jDQ2fRKQWnX7ldcjJfGKipTyjf+2g+hsGBsmiZrts3JBvgVq4+BWii8xnKOf0WbvnquS7kow0BSzfRcHFi9R8= 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: In __cachefiles_prepare_write(), the start and pos variables were made unsigned 64-bit so that the casts in the checking could be got rid of - which should be fine since absolute file offsets can't be negative, except that an error code may be obtained from vfs_llseek(), which *would* be negative. This breaks the error check. Fix this for now by reverting pos and start to be signed and putting back the casts. Unfortunately, the error value checks cannot be replaced with IS_ERR_VALUE() as long might be 32-bits. Fixes: 7097c96411d2 ("cachefiles: Fix __cachefiles_prepare_write()") Reported-by: Simon Horman Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202401071152.DbKqMQMu-lkp@intel.com/ Signed-off-by: David Howells Reviewed-by: Simon Horman cc: Gao Xiang cc: Yiqun Leng cc: Jia Zhu cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-erofs@lists.ozlabs.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Reviewed-by: Gao Xiang Tested-by: Jia Zhu --- fs/cachefiles/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c index 3eec26967437..9a2cb2868e90 100644 --- a/fs/cachefiles/io.c +++ b/fs/cachefiles/io.c @@ -522,7 +522,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, bool no_space_allocated_yet) { struct cachefiles_cache *cache = object->volume->cache; - unsigned long long start = *_start, pos; + loff_t start = *_start, pos; size_t len = *_len; int ret; @@ -556,7 +556,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, cachefiles_trace_seek_error); return pos; } - if (pos >= start + *_len) + if ((u64)pos >= (u64)start + *_len) goto check_space; /* Unallocated region */ /* We have a block that's at least partially filled - if we're low on @@ -575,7 +575,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, cachefiles_trace_seek_error); return pos; } - if (pos >= start + *_len) + if ((u64)pos >= (u64)start + *_len) return 0; /* Fully allocated */ /* Partially allocated, but insufficient space: cull. */ From patchwork Tue Jan 9 11:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13514777 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 0A645C47073 for ; Tue, 9 Jan 2024 11:21:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 944F56B0085; Tue, 9 Jan 2024 06:21:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CDE86B0087; Tue, 9 Jan 2024 06:21:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76E056B0089; Tue, 9 Jan 2024 06:21:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 63F8A6B0085 for ; Tue, 9 Jan 2024 06:21:10 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3B0F9A0134 for ; Tue, 9 Jan 2024 11:21:10 +0000 (UTC) X-FDA: 81659531100.14.92FC087 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 6A10BC0013 for ; Tue, 9 Jan 2024 11:21:08 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YvZbyNVG; spf=pass (imf22.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704799268; a=rsa-sha256; cv=none; b=UsD6cLr/WjmWOpTrnZgBFqlmCowj5mQXagwXkQLrwT5YiQZASCHnGBbsUNqI6VxU829Oad Atr+WGfZQR3NhWj8USKSkTYzu+Hg2aSwQIbgZxALV7oPr6L+vQ72FvWpA+KKdeqs2JHk8A t5pUW/KcmJM5MxGzLXDTcNSqDMEwk5k= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YvZbyNVG; spf=pass (imf22.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=1704799268; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lTmcWwAowP4sGHH2dBxkB2CC/aMCkpFsy2ZSyWuDsbM=; b=ldV4cAu8+fB/XU8Ams2CLXzmGAEwFH1k+cvtsyqkQmFYacqQne4oiZ1JPErzcMCaLw63Sm +fCH7QqWaG6du2Mgj8njzw7tXX4LISmH/YtBB5Ss6Yn5yS70v0PYNuoKswfTxrb/Nh5G1c c2nCek7LTc/gkvkvs7DKWRXO0CcU+RY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704799267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTmcWwAowP4sGHH2dBxkB2CC/aMCkpFsy2ZSyWuDsbM=; b=YvZbyNVGKCzBwREJ/gGaI1jtmaquzUVmRYzEyfvy6M0NW2uLfXJY/JhqVe4s8AkIX9TDAC DtHkRl20h9AXGky/w6HJU2qKs69wwAwdY06ATKYuC90jROOH0gKBm6kOMmShBajZeYsvx3 GUyo1al2ABOC6h4VFQjuGlwROtXQgco= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-625-9U04wNMdOJy50uoFoYMuDQ-1; Tue, 09 Jan 2024 06:21:03 -0500 X-MC-Unique: 9U04wNMdOJy50uoFoYMuDQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD86385A588; Tue, 9 Jan 2024 11:21:00 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0990C15E6C; Tue, 9 Jan 2024 11:20:57 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Bulwahn Subject: [PATCH 6/6] netfs: Fix wrong #ifdef hiding wait Date: Tue, 9 Jan 2024 11:20:23 +0000 Message-ID: <20240109112029.1572463-7-dhowells@redhat.com> In-Reply-To: <20240109112029.1572463-1-dhowells@redhat.com> References: <20240109112029.1572463-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6A10BC0013 X-Stat-Signature: mb86o6nwmz8tftm5yyydos31n88nxh95 X-Rspam-User: X-HE-Tag: 1704799268-845980 X-HE-Meta: U2FsdGVkX1+c2nGh9x1OKPR0dGGs29eMH3MIwALJXJSS6zjX91JpFI/jfTm9PNRmtcfwycWV3rxB/X1cxzOvH7cRdDhnwuU6IV1HCJ6olz/uW3mi1u+TiRw0Y6OPNG2l5DF7JTqGoJnMIfMjVd9OhbHx+k+Ul2OJqMbpojPvdC/eIDSAJoOVe/2OPozO0gdW89/C/xkGl37DpD2Knoi9CkWJmOuAdXpJJi42grp0+EAxq5akiUWYFYLGQu5FsSZUxfJwIxrMzW1tFKfmKPIdmd1sj1+xbVnNmBm9kQsbteYH1WBzOQRaFiba7CbuyG0dAeftJCSxKOsleiqYZ5MqL2JxSqFIjOs4wiu30SkPd8mOGXP6+XkzvSMJspu6A8iZsGWk6WV/JQbja00f8Knu1YrDA6iTLsiZiJOee7/OBIlmTSZQdLPS9+CKzn8V7gVPJaZ6zdtDaqTHDM4MqjQtEanbqEJb5fEJvwdOvievzJ81KXtKECXy8nBDyiEBZoYertCsNP0/kIFvoc4w4sFGTcMHpUH1GS1LQVeCg9wzgCW5MG6c4s/lAEzS8Iaw5RZ4IqoDc7COhBrKiz9l3EJ5HKE2Kn0DfIu/crBhikBuZ2vETwxveuZIDsH+Z1HBJdUMZiO3JpwMHekQFgxZ+mg134eW0zk3B6iIrirKZB0mscSg+V7PptUtBvMXvhHRzNGoStShjsOj0MIWeiKEaJjuBan5I4r9o8hXCZzKl97JY5hJZyYYxlxUNmIjMORKlj4nKzcl1750MKgm/ld1p0U7cjFYX6QFCCa4Msf6hZm3F5Drl4xY1xuUSdy/2xUszqec6/qRyZ2Wpq7BdkYcNyJW/eK/yCcSl5nKqRfbFilRkQqe59DlpqkSUgPN/rWsLgknsBrWMJpMHQAi6/juGGgSj2y7bQIhg2Hier/7h7mUFnHkhiv1TP1wHNyewo8KIINnUjuUu9FdRlspDbuIJkH hbIy6t+X J7xUzT4Va1nWMkNKsCwD7h/+9WFH6NXQKkd2Y1Vmbm33+/PZcNMHLQsAxKbk/brsRzwKvtknCBFi0d15Gm8FNk/AHtdHRRAiB/9aifVUrc4wzwgqLDB8Fmrh6vqwg8uA1BQYrWhPMOh4zdO2S3sSffvDSDtAknI1HcRvNYOJIWzugEqmSG25PclMXhXJDRTYgaf4ZCSzCypLW8PJqg5C5YZCvohKquyMe2l5awsOSBbc7r/JP18t+iVLqJN7e/EfVuEbXGeSebKVrnUaysz70tcqgir/RbA4/u4hVRVazXHYLrhJpozynluNzoFBgwfEMtz80yWhxZbOFkQcVinzcUPz7PI9EgrsgLWA1NrEtfKDUOIxCWDRZzB4zO2hfY1gr7q/MZixO6f2uUNfbcAlpV7rTZmDmtaKyKem0rIrXKE+EgN2OBdqevXyfLbyQ4cciZJMUu4pRaLaGAjelnhAl3N6vOnKHMN+LSh1vKOZoYxeE8HBkmvgWtSNrD5Pxc+tqLETD6jeZDrizGzn0QLI4DIirQg== 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: netfs_writepages_begin() has the wait on the fscache folio conditional on CONFIG_NETFS_FSCACHE - which doesn't exist. Fix it to be conditional on CONFIG_FSCACHE instead. Fixes: 62c3b7481b9a ("netfs: Provide a writepages implementation") Reported-by: Lukas Bulwahn Signed-off-by: David Howells cc: Matthew Wilcox cc: linux-afs@lists.infradead.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Link: https://lore.kernel.org/r/20240109083257.GK132648@kernel.org/ --- fs/netfs/buffered_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 0b2b7a60dabc..de517ca70d91 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -1076,7 +1076,7 @@ static ssize_t netfs_writepages_begin(struct address_space *mapping, folio_unlock(folio); if (wbc->sync_mode != WB_SYNC_NONE) { folio_wait_writeback(folio); -#ifdef CONFIG_NETFS_FSCACHE +#ifdef CONFIG_FSCACHE folio_wait_fscache(folio); #endif goto lock_again;