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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D285C4338F for ; Fri, 30 Jul 2021 22:12:31 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D17F60F01 for ; Fri, 30 Jul 2021 22:12:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D17F60F01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1m9ak2-0005iL-A4; Fri, 30 Jul 2021 22:12:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1m9ak1-0005iD-5q for linux-f2fs-devel@lists.sourceforge.net; Fri, 30 Jul 2021 22:12:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=brcM5lZSHsaI54PEDG56CKlE0X+6aPjSxjf3C0xBYaA=; b=AZrwbrWDbyC8r49so0Nu0/Hr4R dMmcR9DHLMUvUlP1Dz4VZbWoIxlevpzvheFXcmniSOL6RV8I9i2ymbZzER1DlX9bJVhmouRP76JBC qBioamvImDxfyeDZGo4Gvk47WsNrPinXkAZ3kSvb0++UNbeHUoICdqdeHPpWuvKeciH0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=brcM5lZSHsaI54PEDG56CKlE0X+6aPjSxjf3C0xBYaA=; b=RNEfwG/nqq/1Ywot2VqWGyd7mI vP4DpS/F2mzGoDO2/wtifrfg1LB+HnyXshqgOJ6K+Jhzgg6yjyIjZlKJW5njfDE/L8kgAuqC58D4H SRsVyb3Q1OdfMcURccCUnIfSqhSLOG+nYAOhJjfnL6XLqO930vJwrQQeTHxSz+eOhOmg=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1m9aju-0003fI-P0 for linux-f2fs-devel@lists.sourceforge.net; Fri, 30 Jul 2021 22:12:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3409C60F01; Fri, 30 Jul 2021 22:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627683137; bh=z5hNmJdN8BGjw8r8v9HzovZwX29btJP0uJDcs7J+trA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AaivHF8bsl58yq6tjanaqzWD5gLJr8HgM735hZbIElwJGvp/ZMQ1KjvzyTsFlR8PX 7CruPxkf07BFQlExyqEZozNfX1ZQU4E5K2ldMDwVpypeGf8x/6PEs1C0yqVUtqU6f0 2pdz9bc1+laAaQ7VfpeBopksqZkLJ1gLtCQRH4RE9WkpP0Y/UawQKJblM4MCOeiQDC x+WO2yFr0p6dI1r8NlmFmy6O5WNJDeCyEAYUfwt5Fg+vMzoZVgjQI3CA0IiAKn0dnc kBl0vxfMyZ8SSvwSYQb0l6F78I1G1gZ8g1h+fk+tGyqQRO6Xd8oGYfViCUhkxGqacj FzP0g8mNi9nNQ== Date: Fri, 30 Jul 2021 15:12:15 -0700 From: Jaegeuk Kim To: Eric Biggers Message-ID: References: <20210728015154.171507-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1m9aju-0003fI-P0 Subject: Re: [f2fs-dev] [PATCH] f2fs: remove broken support for allocating DIO writes X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, stable@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 07/30, Eric Biggers wrote: > On Tue, Jul 27, 2021 at 06:51:54PM -0700, Eric Biggers wrote: > > From: Eric Biggers > > > > Currently, non-overwrite DIO writes are fundamentally unsafe on f2fs as > > they require preallocating blocks, but f2fs doesn't support unwritten > > blocks and therefore has to preallocate the blocks as regular blocks. > > f2fs has no way to reliably roll back such preallocations, so as a Hmm, I'm still wondering why this becomes a problem. And, do we really need to roll back the preallocated blocks? > > result, f2fs will leak uninitialized blocks to users if a DIO write > > doesn't fully complete. This can be easily reproduced by issuing a DIO > > write that will fail due to misalignment, e.g.: If there's any error, truncating blocks having NEW_ADDR could address this? > > > > rm -f file > > truncate -s 1000000 file > > dd if=/dev/zero bs=999999 oflag=direct conv=notrunc of=file > > od -tx1 file # shows uninitialized disk blocks > > > > Until a proper design for non-overwrite DIO writes on f2fs can be > > designed and implemented, remove support for them and make them fall > > back to buffered I/O. This is what other filesystems that don't support > > unwritten blocks, e.g. ext2, also do, at least for non-extending DIO > > writes. However, f2fs can't do extending DIO writes either, as f2fs > > appears to have no mechanism for guaranteeing that leftover allocated > > blocks past EOF will get truncated. (f2fs does have an orphan list, but > > it's only used for deleting inodes, not truncating them.) > > > > This patch doesn't attempt to remove the F2FS_GET_BLOCK_{DIO,PRE_DIO} > > cases in f2fs_map_blocks(); that can be cleaned up later. > > > > Fixes: bfad7c2d4033 ("f2fs: introduce a new direct_IO write path") > > Cc: stable@vger.kernel.org > > Signed-off-by: Eric Biggers > > --- > > Any opinion on this patch? This really needs to be fixed one way or another. > Probably before the conversion to iomap, as this fix will need to be backported. > > - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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 X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5497AC4320A for ; Fri, 30 Jul 2021 22:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3834C60F0F for ; Fri, 30 Jul 2021 22:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbhG3WMZ (ORCPT ); Fri, 30 Jul 2021 18:12:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:49568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbhG3WMX (ORCPT ); Fri, 30 Jul 2021 18:12:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3409C60F01; Fri, 30 Jul 2021 22:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627683137; bh=z5hNmJdN8BGjw8r8v9HzovZwX29btJP0uJDcs7J+trA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AaivHF8bsl58yq6tjanaqzWD5gLJr8HgM735hZbIElwJGvp/ZMQ1KjvzyTsFlR8PX 7CruPxkf07BFQlExyqEZozNfX1ZQU4E5K2ldMDwVpypeGf8x/6PEs1C0yqVUtqU6f0 2pdz9bc1+laAaQ7VfpeBopksqZkLJ1gLtCQRH4RE9WkpP0Y/UawQKJblM4MCOeiQDC x+WO2yFr0p6dI1r8NlmFmy6O5WNJDeCyEAYUfwt5Fg+vMzoZVgjQI3CA0IiAKn0dnc kBl0vxfMyZ8SSvwSYQb0l6F78I1G1gZ8g1h+fk+tGyqQRO6Xd8oGYfViCUhkxGqacj FzP0g8mNi9nNQ== Date: Fri, 30 Jul 2021 15:12:15 -0700 From: Jaegeuk Kim To: Eric Biggers Cc: linux-f2fs-devel@lists.sourceforge.net, Chao Yu , linux-fsdevel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] f2fs: remove broken support for allocating DIO writes Message-ID: References: <20210728015154.171507-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 07/30, Eric Biggers wrote: > On Tue, Jul 27, 2021 at 06:51:54PM -0700, Eric Biggers wrote: > > From: Eric Biggers > > > > Currently, non-overwrite DIO writes are fundamentally unsafe on f2fs as > > they require preallocating blocks, but f2fs doesn't support unwritten > > blocks and therefore has to preallocate the blocks as regular blocks. > > f2fs has no way to reliably roll back such preallocations, so as a Hmm, I'm still wondering why this becomes a problem. And, do we really need to roll back the preallocated blocks? > > result, f2fs will leak uninitialized blocks to users if a DIO write > > doesn't fully complete. This can be easily reproduced by issuing a DIO > > write that will fail due to misalignment, e.g.: If there's any error, truncating blocks having NEW_ADDR could address this? > > > > rm -f file > > truncate -s 1000000 file > > dd if=/dev/zero bs=999999 oflag=direct conv=notrunc of=file > > od -tx1 file # shows uninitialized disk blocks > > > > Until a proper design for non-overwrite DIO writes on f2fs can be > > designed and implemented, remove support for them and make them fall > > back to buffered I/O. This is what other filesystems that don't support > > unwritten blocks, e.g. ext2, also do, at least for non-extending DIO > > writes. However, f2fs can't do extending DIO writes either, as f2fs > > appears to have no mechanism for guaranteeing that leftover allocated > > blocks past EOF will get truncated. (f2fs does have an orphan list, but > > it's only used for deleting inodes, not truncating them.) > > > > This patch doesn't attempt to remove the F2FS_GET_BLOCK_{DIO,PRE_DIO} > > cases in f2fs_map_blocks(); that can be cleaned up later. > > > > Fixes: bfad7c2d4033 ("f2fs: introduce a new direct_IO write path") > > Cc: stable@vger.kernel.org > > Signed-off-by: Eric Biggers > > --- > > Any opinion on this patch? This really needs to be fixed one way or another. > Probably before the conversion to iomap, as this fix will need to be backported. > > - Eric