Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4733784pja; Fri, 22 Nov 2019 01:01:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyt0cjohqDhMCBz4qmZr/WMZOP+IXIVLqTsfrcdToLxq52shQ9j1deGprdJbTEQMv+8LcAz X-Received: by 2002:a2e:b5b8:: with SMTP id f24mr11008026ljn.188.1574413306574; Fri, 22 Nov 2019 01:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574413306; cv=none; d=google.com; s=arc-20160816; b=nT9rPS7Yas/sDIaGfwSLCDgysvM+7gaTIyMcpxmiShi3D4r5bSwjaDgRWXdQLJ/BdU z39vBIybpCPdoMn+nNVqtXG06vyYmvs3piilq4V1pHAQRhdmXE8srkRiBoK+XGh1zqx9 G2FqWbU7+9PN6T8jzrakGwdto9bFJsuK/5ULPuLz5QuRv4BVfUdFJdHFsXkrrxoZsBmT 90YOsD69D5nFveijWnjG790fVcMbVbrRlFzC8DMZ8dQXaPbaol6rewNUHEXKfWmmdfR3 e/J0EJN7Nx2QF/RNL6ua4jfqKitkK+r70n1oq7rwIMgI1k/gK8a0MATYakBg7mKy1fgM LHqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pdAlM/qy2J9mgq8W7ib6NaoDdjV1KLoho6CJMqImWIo=; b=U10oNxMfzYJLYQ07zegfD2/TT0sOG5Qj55myxx1hpRyftOaUk2NY0vYoGXYnCpV7Er ihphfIM9tYACmbkjDiNx2ItpDchijJoAaFp4lDQyYiS5yiDqDaVI1qncpRkJxQw+uSEP KdkNtlhZ+qH4av1VtMxNhECCPe+Z4i5eInmqdc9NR6N5AlZ2GzkJlwVPWhdA4JSa4fJY uQvo8r5hFpIPjdIamgwnLnTJFckkvxkq7PqsVp/odwfAjLhuSk9bW9vB/RigYIs3Pf18 1gw8jsjyibwd9CCtVRDGAk0ygzXIVT3z2sZJoFgGf+ltMTyRaqnKDgnQX+0MrI1kKEyu h+hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=FIsqbZuN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by4si4331306edb.87.2019.11.22.01.00.58; Fri, 22 Nov 2019 01:01:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=FIsqbZuN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726546AbfKVI76 (ORCPT + 99 others); Fri, 22 Nov 2019 03:59:58 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54383 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfKVI76 (ORCPT ); Fri, 22 Nov 2019 03:59:58 -0500 Received: by mail-wm1-f66.google.com with SMTP id x26so6276819wmk.4 for ; Fri, 22 Nov 2019 00:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pdAlM/qy2J9mgq8W7ib6NaoDdjV1KLoho6CJMqImWIo=; b=FIsqbZuNR/tGKYTPm/IecDxhZ8w+w0s6fYOCwGn+lqZvrAWYx1Zx3SfljyluNSmFv5 iQnRPUjHUmlHGNc4ouyyfdjOHZFV3ZtRG7FuXGbQ46yID4KX41+UKxBEqEddgRu5ATcf 06S/L/GWhFkXR5k9Clp/TGEiNDLLPPkk5CPR2UbIAFD8OREh0AB8j4gqroPacKJk42Uk tvjresCi8wlRKLTjRxM3AJldL8homsZstfBUzMrMtUxR2hSE0S7soLdDX3nL1od5uZWB flHmSY/jHRr8nyGnyefVm33etQFJM6Y/9VixgCixy4OPUlwVM6zEFmsN9m689LGliL06 Igyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pdAlM/qy2J9mgq8W7ib6NaoDdjV1KLoho6CJMqImWIo=; b=gQvRnShL5iWm40iKrnjJIaFXihpdPlzp2EAP8Ddoirps5O4RanEwWEJi38ranV+Jtc 4ayP6fdovFbZUqMYuaO88Vo99DlhYfXUIwB2v/AYJlgf4sO7UTJwLIcBtbIUcFADLcV5 pP4ktlqD7ISJ6q5iQCLOBRJKUcjbkbhUP4ZltX2/Q4E+UkPLaNiC/4Uz5zUdn/jynkCC bx5BSd9WJfZIjXOfvykkuFqsZ+rV1MjFvg6WhFTZXApEYgkqIGGNsSztH4KTK/ZBWfiC Egwl0yab7mras7k/tHZirYZFnwqoYhjiV6BtvzEcHRgJE5Pcl/jDXcCz322XftUQ8NnP aAuQ== X-Gm-Message-State: APjAAAWLmvFTJhlmvDRwBAUuOwgwKEVjRqev2sXEuPUEUQoO0y56iyMY 42KsZSMzxiBttIkmtiNAmd6LP9Xx8bm0rAiq X-Received: by 2002:a7b:cd13:: with SMTP id f19mr10003555wmj.101.1574413195764; Fri, 22 Nov 2019 00:59:55 -0800 (PST) Received: from MacBook-Pro.gnusmas ([194.62.217.57]) by smtp.gmail.com with ESMTPSA id f19sm7406825wrf.23.2019.11.22.00.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Nov 2019 00:59:55 -0800 (PST) From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: jaegeuk@kernel.org, yuchao0@huawei.com Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, damien.lemoal@wdc.com, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH] f2fs: disble physical prealloc in LSF mount Date: Fri, 22 Nov 2019 09:59:52 +0100 Message-Id: <20191122085952.12754-1-javier@javigon.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Javier González Fix file system corruption when using LFS mount (e.g., in zoned devices). Seems like the fallback into buffered I/O creates an inconsistency if the application is assuming both read and write DIO. I can easily reproduce a corruption with a simple RocksDB test. Might be that the f2fs_forced_buffered_io path brings some problems too, but I have not seen other failures besides this one. Problem reproducible without a zoned block device, simply by forcing LFS mount: $ sudo mkfs.f2fs -f -m /dev/nvme0n1 $ sudo mount /dev/nvme0n1 /mnt/f2fs $ sudo /opt/rocksdb/db_bench --benchmarks=fillseq --use_existing_db=0 --use_direct_reads=true --use_direct_io_for_flush_and_compaction=true --db=/mnt/f2fs --num=5000 --value_size=1048576 --verify_checksum=1 --block_size=65536 Note that the options that cause the problem are: --use_direct_reads=true --use_direct_io_for_flush_and_compaction=true Fixes: f9d6d0597698 ("f2fs: fix out-place-update DIO write") Signed-off-by: Javier González --- fs/f2fs/data.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5755e897a5f0..b045dd6ab632 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1081,9 +1081,6 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from) return err; } - if (direct_io && allow_outplace_dio(inode, iocb, from)) - return 0; - if (is_inode_flag_set(inode, FI_NO_PREALLOC)) return 0; -- 2.17.1