From patchwork Fri Jan 10 16:32:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13935142 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E0CC1FC114 for ; Fri, 10 Jan 2025 16:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736526786; cv=none; b=T28JcYIFBfFAN3CMMClb0+uFe6JVOjEr4YRq2HMq7Yzg3IRprN8ftC+FVim3TnfMR98bEY5bQ8UTJhIAuN8UdcE4sLeQoLLxjAJIQyk6aBRx8+R8W4+2vJ0z13aUhRB6HO1Sg0RY9BrNgfGDS5cxJAhzVK+Z8BwFsI8+jln3Tt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736526786; c=relaxed/simple; bh=EGbTOStDpMPosC8iUMFj4zzZcT4coPickjx/yttDsqU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=myi+W9LwD5Ynm7jnuyKjjsR5Ez0USN7KY1fu6o9FSeS0cTl+zEEVVDg8vYEc55VqjdeDmluqxDp0SFbS9j4ZuIidPC7iWUDKPD/0DWlAb/aMFAyjDbiR+thJ3JuSKh7hA9OBPuHVVfYarVoIXnR9YVjif69iOPlsz0NO6KJQF4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ePKsIj26; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ePKsIj26" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=m6Bun1CPydSCXcEYLw8nRgLr5kgwzReIIu7xc3wV6j0=; b=ePKsIj26Sv78SsRSF/7lp4syKG ZA3LIIuT/cPSkx4FB3+pHi+bIxezX5z1oe7nYUuL+7BzRBUd8npUmaLQUweAwji9333wwEKTYhLTk 3VKjPYbSrY/rNOZCit4u8hlLG4OZle13gAFRwWlSn1vy7DK72m6blWgDpbGBR7yJpCnc6v/bpdV2n d5gobM/Vjr1C80uCLWjhM8MLLudSDNic6hXQLhr4CFuSBrx5nGPmEwuvZfVe/cKSpder/1Vvsvixy WP6dMAceDOI1oWDtX3E275lX1FBoGSrF0bcUo08CEFPUneYyVNOLO4h9cV9lZskrW7ivf/xKP/VB4 kW88swlA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tWHwU-0000000E2XG-0rOl; Fri, 10 Jan 2025 16:33:02 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , Phillip Lougher , squashfs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/2] mm: Fix assertion in folio_end_read() Date: Fri, 10 Jan 2025 16:32:57 +0000 Message-ID: <20250110163300.3346321-1-willy@infradead.org> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We only need to assert that the uptodate flag is clear if we're going to set it. This hasn't been a problem before now because we have only used folio_end_read() when completing with an error, but it's convenient to use it in squashfs if we discover the folio is already uptodate. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 12ba297bb85e..3b1eefa9aab8 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1505,7 +1505,7 @@ void folio_end_read(struct folio *folio, bool success) /* Must be in bottom byte for x86 to work */ BUILD_BUG_ON(PG_uptodate > 7); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); - VM_BUG_ON_FOLIO(folio_test_uptodate(folio), folio); + VM_BUG_ON_FOLIO(success && folio_test_uptodate(folio), folio); if (likely(success)) mask |= 1 << PG_uptodate; From patchwork Fri Jan 10 16:32:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13935143 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17B7B212B2D for ; Fri, 10 Jan 2025 16:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736526788; cv=none; b=sczNEsZnwrW51n+hJyG9OtcyDJsUiZtuq6QAEbrJdLGlTLCNdRIk3f3NHMmsA9ao/4GYp0JmgR8LgzGI6L5W6Qg1sAkIKXW0EujnmyFIZZd+SqtrJi1nBUf6d8g06bKBhz0S+JodqWT7+iNI2f5uB9KJ0BXpDjErVWUJ9NaBP0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736526788; c=relaxed/simple; bh=FS96Xtr0TvvSmGEoIVtbkxgnDeIXPINwUTajJDG3rCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ri8N8lZwGAa62mpcOaSQUXtzgBQxEkkq2nJt6OaC1ynZ+CXWTuo5mJsGyxWIyDBsy4hd/UVI4EiAxKgpXzSnRWOaTWnHD0LQ4lkzKzFRCJExhW4X0grj9zpoxgDLc4ljca7fbUgsSOTaqqh6hsDDWTPabSDOZ5GKd7p9peoFDUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=dt+oyK2P; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dt+oyK2P" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=DH+Cxm6d8lwPux5CX2sjl6rLlWpVJbxOakxzkL9rSrg=; b=dt+oyK2PWWQthDsLKdUanaCqQT FkxaXu0YSv9JpiQOp0CqsWnEnioXQ+64fQFRy3cazHsCtp3KMELYscWqW8wod/sMW59uywJ+ll6c0 NrI1om93APA6SPI1dKXdYd7DGBaDFuu3hir5feSHExbcfT2goxTzOI7grJiBD/nXnEEctKbdKYbxk gwcP3vC70+xHVEr27sqGy7W+bRbVYbTnTPNFELg+WyWhlFm55J7CiXNLD6Xkz+J17F4ubi8mn7tly ZME5dArbOpMMz68tCCtCwa4ay1Je/itsX2TA6t0gr6XBZyNz4gBvRH5Zsk9w179qG9XqPc8W6yClg 0677aJ5g==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tWHwU-0000000E2XI-1H75; Fri, 10 Jan 2025 16:33:02 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , Phillip Lougher , squashfs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, Ryan Roberts Subject: [PATCH 2/2] squashfs: Fix "convert squashfs_fill_page() to take a folio" Date: Fri, 10 Jan 2025 16:32:58 +0000 Message-ID: <20250110163300.3346321-2-willy@infradead.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110163300.3346321-1-willy@infradead.org> References: <20250110163300.3346321-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 I got the polarity of "uptodate" wrong. Rename it. Thanks to Ryan for testing; please fold into above named patch, and he'd like you to add Tested-by: Ryan Roberts Signed-off-by: Matthew Wilcox (Oracle) --- fs/squashfs/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index da25d6fa45ce..018f0053a4f5 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -400,7 +400,7 @@ void squashfs_copy_cache(struct folio *folio, bytes -= PAGE_SIZE, offset += PAGE_SIZE) { struct folio *push_folio; size_t avail = buffer ? min(bytes, PAGE_SIZE) : 0; - bool uptodate = true; + bool updated = false; TRACE("bytes %zu, i %d, available_bytes %zu\n", bytes, i, avail); @@ -415,9 +415,9 @@ void squashfs_copy_cache(struct folio *folio, if (folio_test_uptodate(push_folio)) goto skip_folio; - uptodate = squashfs_fill_page(push_folio, buffer, offset, avail); + updated = squashfs_fill_page(push_folio, buffer, offset, avail); skip_folio: - folio_end_read(push_folio, uptodate); + folio_end_read(push_folio, updated); if (i != folio->index) folio_put(push_folio); }