Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3960556rdh; Fri, 29 Sep 2023 07:24:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEC/LYS48Aq3nD0wdbp2GjlRu2y+n2/5LN3ZG0dMhN6ijPTDDyejPAKg/Y+Yv0LbwZ2Ui9K X-Received: by 2002:a05:6a00:1996:b0:68f:cf6f:e228 with SMTP id d22-20020a056a00199600b0068fcf6fe228mr4645697pfl.23.1695997452951; Fri, 29 Sep 2023 07:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695997452; cv=none; d=google.com; s=arc-20160816; b=klJdFPilCtbSNn74sRoP6zfVa2qqiAkZ55cnpR+OGW07h0sQ3qfnKC9Ns0n6XdvJTq yu6ZWUd7s4aKG7Dv37KYq8PzVs/hbOO8KpGK01hjdCAzZT8Lu05pB7rGQvmvW+u+wHlQ c/WPbKAiVH0RLwFK5okVesR3FtkKCRSH5qGSC1GetaA4Bs3iNdNxdVeqvFXHAP71aYAC r5rp5nHgL2PjQbcMvUWKC4sn8evTkLkoW6gETs/+gWn2+kcYwoIORO1pPia8mefX1G5E pJgMN6cPBAPBndFh9U0Z2ZXz48aYlkORArqCSn4+V/L5GNMoUq6fYCYpyBot6YyzJc6x wLQw== 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=3iFgT2hL5v7egyQsA5xb5bDloBaqziDf6HBd6OHGXNg=; fh=PJMzc3Hp2p3Dvzr5TvkhdjVsfQ/xiDeCtVytQiIqKjY=; b=Ao2fu0Lp+d4fA+CozjbG+5iedI8c7Dn/jCmmCNvDPA6UcHillPzJ1IbMIFjCnRVUTj RwB3k7KHjHwjGYB77gzKW7BBWvx6LZhFEddozrhX/jDJ9UFOKiryll/cln1B2O6d1vNp XGl2wQY9Q7nWLyvJEJzTUw9REeuwQZjtEJajyXZcX84Ao0SAmYcOrO9ppy2Z/ETZ2htU fibZ/No6wnHGgdfnK7l2k105zfLWnuUPLZ1OCsHmAWufFVDi57sZNg0Tq9hMdXzdLBip iHvGgEIZIKgUiId8K/Z0Qc6ELYGrU4lnPDK87fHok0/JDUDpmSf5iPpx1SrJJiEA4TNj UUug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=py6wDax6; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z19-20020a63e113000000b0057768a32896si21529248pgh.365.2023.09.29.07.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=py6wDax6; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 26E2C809D33D; Fri, 29 Sep 2023 07:11:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233113AbjI2OLD (ORCPT + 99 others); Fri, 29 Sep 2023 10:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbjI2OLC (ORCPT ); Fri, 29 Sep 2023 10:11:02 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A6361A8; Fri, 29 Sep 2023 07:11:00 -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 38TE77xi020559; Fri, 29 Sep 2023 14:10:55 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=3iFgT2hL5v7egyQsA5xb5bDloBaqziDf6HBd6OHGXNg=; b=py6wDax6jAPmswsFd1/8MKe32wPSxVh8VHejj+aLB41zo/HBxTcOl8FEHnCqwGfkLiCd FJGL9JJLlxEt9a+gODIePrz3MwPjjtY0/M8/x5G1XLZZb0xKAiY8gcx1NIk71Yf+TUNh R5QiXf0GIUZxcmPBWpRtnnj/fbzhSk0G12nG8L0EB/WBnHmWReR7WRWT7JGeZ3wyPulD LkzmQcWdIRI6V6RqQl7sRkMZm9G6WMfObGOovPRoEf4VYzfkcoRrRgZ7CGIHTxFiOdsP NCCwlYm2cWuZnlO35MQPVowiowg60xoMYoBZpx8LNNkGdCbt3uN+8nBz7IuVYG/LnsKL 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tdxy5j0rb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:55 +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 38TE7uIf024507; Fri, 29 Sep 2023 14:10:54 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 3tdxy5j0r0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:54 +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 38TE57Xp030454; Fri, 29 Sep 2023 14:10:54 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tad22cmby-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:53 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38TEAq8m46138076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Sep 2023 14:10:52 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23B4220040; Fri, 29 Sep 2023 14:10:52 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7BE8D20043; Fri, 29 Sep 2023 14:10:50 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com.com (unknown [9.43.84.228]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 Sep 2023 14:10:50 +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 1/3] ext4: treat end of range as exclusive in ext4_zero_range() Date: Fri, 29 Sep 2023 19:40:43 +0530 Message-Id: <9ae3bf53e81554cec3e609de8e8939b90966f7ab.1695987265.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: V_e8aAuLSi14wrQ1xApHSAydaFND7bUE X-Proofpoint-GUID: F-7tyQyTkuvOpxA3Cbu9Gox9aJk5Wexz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-29_11,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309290120 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:11:12 -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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index e4115d338f10..c79b4c25afc4 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,7 @@ 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