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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB8E2C54E94 for ; Thu, 26 Jan 2023 15:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbjAZPP2 (ORCPT ); Thu, 26 Jan 2023 10:15:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbjAZPPZ (ORCPT ); Thu, 26 Jan 2023 10:15:25 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0284161856 for ; Thu, 26 Jan 2023 07:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SVSoOmOkAv0qYrFF5AaQQ5wZnGROZeVJYi9nhjejcH4=; b=bvHTLd2/MBh8CJm4f1Qad67IVU OltafoB+leWzqyRzks/wdnTbu7bAlostQoGgb7q/L8qik4zWHdv67wemCAp0+vIhTsE7Rz6t+Rfs0 hfxKvPqdGmAeb0C6LWkysLAU2wIdIrXhZcEQx/g1wD0xWQbQbPWWrj8EZRsbpyh7TtK75HCx9B5jt DLmI8mIZ2xZK/UH39Pmmw1h9ndjFvQAeI4YhVlmBoAOdyZPxuMZTnszD8nny8/GivhF5gVkCerdA3 xJgMXqMcwqDt6RUfLIzOLA5MHPL4nmVp3nkI/DatRKLQ3IoEhpaiMnPF7j7w7UnVXkOtpOYIEHTzB 2MHjBnzg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL3yC-00BRUY-NH; Thu, 26 Jan 2023 15:15:20 +0000 Date: Thu, 26 Jan 2023 07:15:20 -0800 From: Christoph Hellwig To: Jan Kara Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig , Andrew Morton , Matthew Wilcox Subject: Re: [PATCH] fs: gracefully handle ->get_block not mapping bh in __mpage_writepage Message-ID: References: <20230126085155.26395-1-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230126085155.26395-1-jack@suse.cz> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Jan 26, 2023 at 09:51:55AM +0100, Jan Kara wrote: > When filesystem's ->get_block function does not map the buffer head when > called from __mpage_writepage(), the function will happily go and pass > bogus bdev and block number to bio allocation routines which leads to > crashes sooner or later. E.g. UDF can do this because it doesn't want to > allocate blocks from ->writepages callbacks. It allocates blocks on > write or page fault but writeback can still spot dirty buffers without > underlying blocks allocated e.g. if blocksize < pagesize, the tail page > is dirtied (which means all its buffers are dirtied), and truncate > extends the file so that some buffer starts to be within i_size. Yes, this matches what the buffer.c helpers do, so: Reviewed-by: Christoph Hellwig