Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp320437rdb; Thu, 30 Nov 2023 05:54:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbb1JElTR5X6hFZEcHSccHy2WMJkUaXv04WO7k/2DjRrETEwus0leWDxlAwXL8WVUphKyW X-Received: by 2002:a17:90a:df95:b0:283:a384:5732 with SMTP id p21-20020a17090adf9500b00283a3845732mr35909167pjv.9.1701352445866; Thu, 30 Nov 2023 05:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701352445; cv=none; d=google.com; s=arc-20160816; b=sbn5k3aZusUHqPoNLONR5yTbHZ/dwJ/gnK4OPf2YtW1cHQXraysNuitfX4xocIY1sZ ucB0LEZiO2XcGefmKMQtbdzypWG6dj331S5oVXDq8h1HSmyfeVya8X2um+rv4j5E0nm1 YhqmpkFNaKAFJjvXXxfXxSYRpmxSqGX3wvrOxOjY0b578fn+xO6rLAvhfn1mN5rooIqZ kNWLMvRomb9OrFauXipxGv18KqoETK4Z1l7SPYN57owHblVtWeF/7Oh74qnFGaBKNJC6 U+mR6/BqWcSRVwbxdEoTiltQzlm3WuKZDOA8N7ru15z3YL+jBaOhIj9iofDsMcELZLR1 L+5w== 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=PNIwPfumSNnVlUUlBo/GDih8RAKZHb0Z2KAJ+LhauC0=; fh=o0c9oRQqGcw+lX35liWyz4mGWjDo/97N/+E1+y9wprk=; b=uHMWK9SIHMuIaPDlCkLt1EmnDxcqeICiEJ/zAIUmWw1KmAiXtY/k/Nxc6s+FWJEoOq RE9Uced2ftLRUPKwDy1JUXkfM7fmza5ynrNrnqwxp01QP5w2mB1f863hQiubxglY/A2o DdDDC6TAGUddnGKnkWWSYpF/sSA3LRbUwWooBxolj2FLdBOKNmkh79W6dtF8f7C70N6q qTtm1hkvYawF35G/WO2LjX8saehdDQ2Ovm+/kWWDCRSJVeMV+InwXCC1Jx/mNSSyhiO0 xycxKiO+OuC5OD249fAYyn332PdXwq7XvKnqtjtbk+WnkjD98V2QlOfqzqLqxUc522kt avNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ungc5id+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f11-20020a17090ab94b00b00283a439a059si3533169pjw.188.2023.11.30.05.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 05:54:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ungc5id+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8C04E8027664; Thu, 30 Nov 2023 05:54:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345853AbjK3Nxt (ORCPT + 99 others); Thu, 30 Nov 2023 08:53:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345752AbjK3Nxb (ORCPT ); Thu, 30 Nov 2023 08:53:31 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E3761709; Thu, 30 Nov 2023 05:53:36 -0800 (PST) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUDFpFE006446; Thu, 30 Nov 2023 13:53:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=PNIwPfumSNnVlUUlBo/GDih8RAKZHb0Z2KAJ+LhauC0=; b=Ungc5id+xDFLfOdwyqgvYbHfIvdJ1LgR1wfvB8HEWxM6aTunXdel15SkCiDS1+DH2NxQ 4dV6369cWKoDjbwBdL/ZsSevfNX97wwl6feyvymUaI3e7R6anF/EkNbYmlNM87v+IYC9 zWxKQsSA41B2sAD4mzLkTjz4oMr2AZJ4XStc0N4rZH9M+gozec21C8Qq3obLK3BKYK7g tmqKxjiwNRBnWE0bf2/HaOSyKeVDnwLzb/1UJbk5WS1WHHNSVm/tEh2u9xSFEqqZK3tn dGO9e+wbLEW6uEJkWGGepCx4rrNFvPPCJK9zeWAWVKzaq8knbq56Iz/aIRGZEova45eJ /A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3upu4b983u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Nov 2023 13:53:31 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AUDGX1i008254; Thu, 30 Nov 2023 13:53:30 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3upu4b983b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Nov 2023 13:53:30 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUDmw70006089; Thu, 30 Nov 2023 13:53:29 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ukwy25vsj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Nov 2023 13:53:29 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AUDrSUq6554294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Nov 2023 13:53:28 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFABF2004B; Thu, 30 Nov 2023 13:53:27 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CF7720043; Thu, 30 Nov 2023 13:53:25 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com.com (unknown [9.43.76.38]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Nov 2023 13:53:25 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, "Theodore Ts'o" Cc: Ritesh Harjani , linux-kernel@vger.kernel.org, "Darrick J . Wong" , linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, John Garry , dchinner@redhat.com Subject: [RFC 1/7] iomap: Don't fall back to bufferred write if the write is atomic Date: Thu, 30 Nov 2023 19:23:10 +0530 Message-Id: <4c29ab39998ef21898e930ad78588d105f4d81a5.1701247289.git.ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: F5E9TSUM1DCcqBAO5JInTGaNPQrrdbge X-Proofpoint-GUID: Ezm7edadeu2lyI1-UAjDTOwNZDGRhuxN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-30_12,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=824 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311300102 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 05:54:03 -0800 (PST) Currently, iomap only supports atomic writes for direct IOs and there is no guarantees that a bufferred IO will be atomic. Hence, if the user has explicitly requested the direct write to be atomic and there's a failure, return -EIO instead of falling back to bufferred IO. Signed-off-by: Ojaswin Mujoo --- fs/iomap/direct-io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 6ef25e26f1a1..d7e6c6eacbf7 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -662,7 +662,13 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, if (ret != -EAGAIN) { trace_iomap_dio_invalidate_fail(inode, iomi.pos, iomi.len); - ret = -ENOTBLK; + /* + * if this write was supposed to be atomic, + * return the err rather than trying to fall + * back to bufferred IO. + */ + if (!atomic_write) + ret = -ENOTBLK; } goto out_free_dio; } -- 2.39.3