Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1001752iob; Wed, 18 May 2022 18:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYHA71wsaKH5V0O7Z0JmUijp5e/BSgcOuiuoqQXd78DEMVOE9n4cmSfh/7k2tz3g/iQ5jd X-Received: by 2002:a17:907:7b96:b0:6fe:4c66:b6f8 with SMTP id ne22-20020a1709077b9600b006fe4c66b6f8mr2141440ejc.20.1652925323839; Wed, 18 May 2022 18:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652925323; cv=none; d=google.com; s=arc-20160816; b=tsFRkBmQTT6w99tAMmr/alStyD15soC2GuJiaokNmwfoNH14ezi8whsNc8eDLRcmTD m3PiHsd3ssr41nHpKSBvRsSfrUKM8V3QRCcB0oylhKmruVVi+OG5ue883ZpT+4jZDP3p AMxPRuj2uaXay3c1t4zF9L9IA53KDbiGjrXTn5SoLJtnBrq9qcqZB1RPj8vdS74B9p3u m+PwTAURkLIvubakCKCkrMKmkKt2IsL8Ivus+NEktucJnD5S0naaAnAwl5L93eJCLpLt cfq/T2QiUbnffZXHRktZldcQCZJKejAOTDC+f5gnjR6zxVd8RBTMeJsFak6ytvKgiDD4 stkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+RDaEEMK4eT++lo3xgpRp/qjzTM2quZ8kl0hZwgItoE=; b=B0xZy3FqFOBMnY/OPKso9dQzK/QJ3b9Qqjrxf8/MWS2HVB/0icJh+2njUwdJpFFEqg gWSUTSZVlK/cIaRMRIrmHS26SQZGp43cMcaYwQGcYP7SU9QRauISI6F8bhnO2T4+wG15 IqTFZgYVgJIMc8pr02Gk6+MheSTdxnNIgZaBa0eSxpIaDAbMHVPQIqWaZIebnxb7Yqax ERCk87Bb7PB8wRfliJbsQV8k0O71d59b+Z8KbYPcYIKzlYeZq5KXSfQQAHf56vWiiY9g /E3SLpA8EppgCyWxd3ieUNxtnxXn6Smx54KDqPIFTQQ+yX4JlkQv0iTPAewigUOoogau c4aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="owfg/F0x"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz14-20020a1709077d8e00b006e0f9bb12a5si4371711ejc.253.2022.05.18.18.54.58; Wed, 18 May 2022 18:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="owfg/F0x"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231643AbiERXxg (ORCPT + 99 others); Wed, 18 May 2022 19:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbiERXxd (ORCPT ); Wed, 18 May 2022 19:53:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE86D11E; Wed, 18 May 2022 16:53:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE2AF61765; Wed, 18 May 2022 23:53:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF9F6C3411B; Wed, 18 May 2022 23:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652918011; bh=ZE7itEEPnptZhGuc8FqpYj5SCJPv5va5nQLMU3S/gQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owfg/F0xZThvzpCjzSoA1MRFeGdGDwzUdcPeWd/alnsvpgMVvJEqqh9PdOMPWq+5g /KOGcKBOtdGO3bDbcoYZ909SBYVoR2hEHX5w9T8wy9o3f3lDvn6okpsMgYi75IoNuv QVQBMz3l/DO+qa5omaNeIMR4O27xp0nUtc9NRcVMeiugPTmJBcRZ1/4FrC7bzcGRTz 4Hls4MRp41Nxu2UlJiYHRO/txX42QDmjODhpp+uuPWBBnyGAusxCKHgPBdTl2d9HuX yDaqaT40qaOnKwYIHf8DaGG90QFkPxNALhH9WhZZUY7qMWFFrzVzTP9T/4kvBMgsAn AeRd0FgWLGaWg== From: Eric Biggers To: linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-api@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Keith Busch Subject: [RFC PATCH v2 5/7] f2fs: don't allow DIO reads but not DIO writes Date: Wed, 18 May 2022 16:50:09 -0700 Message-Id: <20220518235011.153058-6-ebiggers@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220518235011.153058-1-ebiggers@kernel.org> References: <20220518235011.153058-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,SUSPICIOUS_RECIPS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Currently, if an f2fs filesystem is mounted with the mode=lfs and io_bits mount options, DIO reads are allowed but DIO writes are not. Allowing DIO reads but not DIO writes is an unusual restriction, which is likely to be surprising to applications, namely any application that both reads and writes from a file (using O_DIRECT). Given this, let's drop the support for DIO reads in this configuration. Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 67f2e21ffbd67..68947fe16ea35 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -822,7 +822,6 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, struct kiocb *iocb, struct iov_iter *iter) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - int rw = iov_iter_rw(iter); if (!fscrypt_dio_supported(inode)) return true; @@ -840,7 +839,7 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, */ if (f2fs_sb_has_blkzoned(sbi)) return true; - if (f2fs_lfs_mode(sbi) && (rw == WRITE)) { + if (f2fs_lfs_mode(sbi)) { if (block_unaligned_IO(inode, iocb, iter)) return true; if (F2FS_IO_ALIGNED(sbi)) -- 2.36.1