Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp1041311rdb; Wed, 1 Nov 2023 09:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIUDQT/435LUoIP2TstQv5hh6r3hqLVeA3BMi5eqd8Y9mvrctVNv64J0K1DNa9dllXIx4A X-Received: by 2002:a05:6358:6f12:b0:168:e73f:c9c2 with SMTP id r18-20020a0563586f1200b00168e73fc9c2mr20163385rwn.8.1698856735531; Wed, 01 Nov 2023 09:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698856735; cv=none; d=google.com; s=arc-20160816; b=w0WRmZusslmQdbdl3NCzbyoqfTVlYgkGuVdaeu7KINbe6oC/5Z/ORrb1G7lgb+/GJe X0mCaDVl0V6RxlzkbC0IEYMWrEIgmz40+XWHYHZcUhUBfwRtCNLakycMSqpOk4Fz01F1 vJ6I1/fE35AkU4/2/CX4OA6PADLmm7daBIXJN/63NS92w1e4F2+58Fef60RekzedcFmY kWKY4Ya8GnpOY1YO64y/XUdZUWBMRxn93b4OzDXuzRQvBSm38xbD1OAwy2D3PZIvF8Mt msFN2H0mstiswtohNO4t5n/XqQW11q2hvNBe7+nKPBir+rI4JdyHShNeXifudWuOyYnt Rmlg== 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=30VE8h6m1wLRe773DqtdEN8cCwLPLvKHKL337+GsgNc=; fh=PJMzc3Hp2p3Dvzr5TvkhdjVsfQ/xiDeCtVytQiIqKjY=; b=Im9GcTo+ZKHXBTf9Sgco887BFnTqDnDlImlEUpNg6DiulPBhJbYoeXziFHrDmMNbq9 mUZc8ioCCV0i4ubWEU3D/rzLcp1rgHCvTEV+9c6X2bCGERtyAnlJBZ3UC6htsbZY6F3G smsiVRK9MXgbPqemLp1/cKlzRJTHzNe1xc+rbk9utRRFT6wAYBXWXwLryotn8dau2mlF oDmSOyvzlX+WBMKmTrHImRNIyL54Xbpp9RltQrLDlkk3ZKBuOMCSWFxtsJ8ddHT6mAO/ J8rf+e2G4jGYRmxw0g8FeqvuqX4CYjviruToz+gX2GN7rnd/G06EN2/JjZTDFMVCyfCE 63Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qo1kALzb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-ext4-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. [23.128.96.37]) by mx.google.com with ESMTPS id a64-20020a639043000000b005aa833a5337si187815pge.600.2023.11.01.09.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 09:38:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qo1kALzb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-ext4-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 446E08129E28; Wed, 1 Nov 2023 09:38:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343931AbjKAQi3 (ORCPT + 99 others); Wed, 1 Nov 2023 12:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbjKAQi1 (ORCPT ); Wed, 1 Nov 2023 12:38:27 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3899FD; Wed, 1 Nov 2023 09:38:25 -0700 (PDT) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A1GMKnt005565; Wed, 1 Nov 2023 16:38:21 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=30VE8h6m1wLRe773DqtdEN8cCwLPLvKHKL337+GsgNc=; b=qo1kALzb6Tgs+L97t/SoyKHGC/pG21bC3Pv0nnY9a33WHbq3OTMxNRHu2Y3xdw36e65R p1IWJRfir/2GHhIs1OkpIl29UUxCpadI+9P7j3mINFokFAMZ3TqXrrfUGq9KnVA5n6xM HcyJhQVGt8AUJTJQZFEp5Nx1q4/T0TRqfas9mK25+0zN1cU0Bo/3huILDNyuZRfKX8qY HjTGLf+5FKR3f3GkvJS0dh95ifvULvW7Cr/noaJUvLbCRVTtbfLl728IGIoD2maFFQfj rmcsAecLCLhSb0hO8r4n4oYlFxNO01lurhul5KHUokwfqgjdEwFV7/eMZ9upem97CfHe EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u3t4w8kc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Nov 2023 16:38:21 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3A1GNVNP008087; Wed, 1 Nov 2023 16:38:20 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u3t4w8kbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Nov 2023 16:38:20 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3A1Ebi3X000583; Wed, 1 Nov 2023 16:38:19 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3u1cmt92jh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Nov 2023 16:38:19 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3A1GcHU919989114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Nov 2023 16:38:17 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3D2720043; Wed, 1 Nov 2023 16:38:17 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4250D20040; Wed, 1 Nov 2023 16:38:16 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com.com (unknown [9.43.9.163]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 1 Nov 2023 16:38:16 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, "Theodore Ts'o" Cc: Ritesh Harjani , linux-kernel@vger.kernel.org, Jan Kara Subject: [PATCH v2 1/2] ext4: treat end of range as exclusive in ext4_zero_range() Date: Wed, 1 Nov 2023 22:08:10 +0530 Message-Id: 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: BapsqX8aZUGVEIYkMStMKts2RP8P9jry X-Proofpoint-GUID: qxYIvFvSjSF-FIBk-HLGmkKg2hECJSbx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-01_15,2023-11-01_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 bulkscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2311010131 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,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-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 09:38:31 -0700 (PDT) The call to filemap_write_and_wait_range() assumes the range passed to be inclusive, so fix the call to make sure we follow that. Signed-off-by: Ojaswin Mujoo --- fs/ext4/extents.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 880f383df684..265ae30a51b9 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4522,7 +4522,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, * Round up offset. This is not fallocate, we need to zero out * blocks, so convert interior block aligned part of the range to * unwritten and possibly manually zero out unaligned parts of the - * range. + * range. Here, start and partial_begin are inclusive, end and + * partial_end are exclusive. */ start = round_up(offset, 1 << blkbits); end = round_down((offset + len), 1 << blkbits); @@ -4608,7 +4609,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, * disk in case of crash before zeroing trans is committed. */ if (ext4_should_journal_data(inode)) { - ret = filemap_write_and_wait_range(mapping, start, end); + ret = filemap_write_and_wait_range(mapping, start, + end - 1); if (ret) { filemap_invalidate_unlock(mapping); goto out_mutex; -- 2.39.3