Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp363389imi; Fri, 22 Jul 2022 00:15:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v44c2HVocxZS7Rw4NZSUBnvPOH89nGlXIfxKIplYkcW0aUP2A8FJXgZ31WC2XpUrbi8yot X-Received: by 2002:a17:903:31c9:b0:16c:3024:69c4 with SMTP id v9-20020a17090331c900b0016c302469c4mr2218205ple.81.1658474109928; Fri, 22 Jul 2022 00:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658474109; cv=none; d=google.com; s=arc-20160816; b=GRrgPEmtkDFTQFLT4Z6gXlhIf3mS1DR6h5a1xv4TyxFaUXYCG6m+dKKV4SiU2OyhL7 9C2OD1Ex+KVxApPI3/R1WuKDsyEUbCGt9tlxjuJWFSMSnehKnj9P99e8RviJBhybbdBp xH6oHurAQM95OZei/4zVXfglkrythML1wI8ypHSioo+UE1kNzpKVgp7TsLaiZ/SyVzu6 tpjQl+FbEu9FkQWCrP/7MNnJ6gc/DlusC41c1vyenFNbIXTl2AMUR1GHJRnmPLGGSjK/ JgFv5HpzRiHmEHuS6dw6bGYZ3fSYCe6NH1/FUqMKOZ/6vZJWivp25kxQq8PPUHbu8R0y zgxg== 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=9DeTB1BlLGtFZlKSCseppW7W1ma7vwKEa7dw5sSLkFg=; b=yHrsgNqzPlHjw2mWLFOYPf3qqtGng0Z7/0ZAKdbvZ0/2Ey+XxT5sVPr2aer2UaR/Ru HiNMPsjSNw0zaTV5khbgjhVwuyywtq62OQ9z3ywxvfmJlSNSWdcuGxftYO1edI5TYgdn ezcflg53fwujqLEkrEVh7vMMU+TGOoczmz8yjw6Yq1v27oTwEnS/UpyW3w2tjxG2vc09 UEk9tPQcvpKvDur7S3W4akKovwgkON+ZFQJExsF9hmX9THv826VV+QJYS73L1CSibwFu 6dzmx/rDXsVGvjXSYm7jjaze7VuBF0vgombH5ajhoLwnIJx+SUm9aS9Pz1Eebqj01b/9 k9pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=II9Y3TRu; 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 t5-20020a63dd05000000b00415dfbed12bsi4489498pgg.514.2022.07.22.00.14.54; Fri, 22 Jul 2022 00:15:09 -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=II9Y3TRu; 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 S234006AbiGVHOU (ORCPT + 99 others); Fri, 22 Jul 2022 03:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbiGVHOG (ORCPT ); Fri, 22 Jul 2022 03:14:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59599936BC; Fri, 22 Jul 2022 00:14:05 -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 E14CD6219F; Fri, 22 Jul 2022 07:14:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73054C385A5; Fri, 22 Jul 2022 07:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658474044; bh=Xi5JrwkGMRjNbBiivYG5NLjIO4EBV+YXLEfJAlDv+2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=II9Y3TRuV9mm5FKGUq5vXuOGQbIVBnrNvh78iv2geP1tmChv9AzzLQZYDqm4tQjb1 S0pSKHPSNGTKRaUtmDdMPde0Dj5C5Wg8vaKKKjRtMslmfrBqMJ9MbHQSEdknxSyV5o c7lCTbLiFarDSsGfKNd+49lsVxNM1ITiOdNs5hOcoN0beKAa6M2vtbYYsrg43YGV4H 8wht22UspK6ct/EI4E4Q3pUB/9MR8qux46/w5MfdrNHJxqs//qv8FCoqYj451co34R KfN393kPHJT0O3hO5nTk2Ihtyt6BrjkBkKiKdm5UVjVoJtBuBUktXJC7aho/mGlyvX 02EQXEBwohTqg== 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: [PATCH v4 6/9] f2fs: don't allow DIO reads but not DIO writes Date: Fri, 22 Jul 2022 00:12:25 -0700 Message-Id: <20220722071228.146690-7-ebiggers@kernel.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722071228.146690-1-ebiggers@kernel.org> References: <20220722071228.146690-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 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 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). This behavior is also incompatible with the proposed STATX_DIOALIGN extension to statx. 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 5e5c97fccfb4ee..ad0212848a1ab9 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -823,7 +823,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; @@ -841,7 +840,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.37.0