Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp264602rdb; Thu, 2 Nov 2023 03:08:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqEw9I9PcsaYWVFChZbirXHJSNWqY51CSz6Vjej+E3/rtPPDKg2m3Dw1C+kOMHgy3Ih4Xu X-Received: by 2002:a17:903:2344:b0:1cc:5a74:b1df with SMTP id c4-20020a170903234400b001cc5a74b1dfmr11175718plh.2.1698919737825; Thu, 02 Nov 2023 03:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919737; cv=none; d=google.com; s=arc-20160816; b=Tw5VsFp39yVIVF2HgatX8nWDOF3/5bEteVdwE21ADr8eCBdjRVyWseFwlmXl1MLY1D e/9SKx8YGMdif3cxHaxsd6LnGh6roQr0ScQv3vQSHBGX77WafH2B6YAOAiluYIqtfiDP Ra77QxDoiMFrr7Jm9ZYswrYtyiKMyI34lpZmH09LKqj/DnYZhW/fuLiO/mwgXJvpmsq9 96U6Pvwmp4SfA7lFb15zd5u38POVdTlsEslflNPHuvTPyR8r836Ts5ueNcSV40DAJKFj 743xJv3/g3Yw6RrzekieLGRsIZiUR0fr5WTYhriO1rCe1ZDf64wVRr+LxIzVeOSBTxx4 LHBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=FsbHNsMbfhoTRCwzDvCjMOcypitr1Q8y92FNQVrgWfg=; fh=9YeD+/1Lt1hy1WwsFf2xgL+JaQVwRkyLtT/FOmbm2fg=; b=bFtsR886/hO8OtpUhvV2E2ux1YMTbOyBRmOoAGHWKGQtHEc9l57aW1hgz6tniUUASk /LwNzcKhbpOZu486uGZyuKK6XGIpqN0SwZq9YvqoVYJF0D+mzpGaHlRz3gimxqhzYzZa uPfaoPGhEBkjc1P97F/icFrEjHGXGc9N92z/sDa2wbZm8EDJQQdB/p2qkqMPhyXxemGV h5kmyCop2An1TSeXHYVmQkmuULm8WwnYwBCbGSdmk1wyimCt9wqDNydL0LPuQQKfih1+ xk18dh1eYsYWr5Z0GtZBN23AZpUerL4EVaCQguo6nFWCMISB5ZtuQZN/okzvxSN0n+9A o8hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=grBBTWxg; dkim=neutral (no key) header.i=@suse.cz header.b=4gYfgycF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q16-20020a170902dad000b001ca81fa0661si5028391plx.508.2023.11.02.03.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@suse.cz header.s=susede2_rsa header.b=grBBTWxg; dkim=neutral (no key) header.i=@suse.cz header.b=4gYfgycF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 828238212A92; Thu, 2 Nov 2023 03:08:56 -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 S1346330AbjKBKI4 (ORCPT + 99 others); Thu, 2 Nov 2023 06:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346147AbjKBKIx (ORCPT ); Thu, 2 Nov 2023 06:08:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF62A136; Thu, 2 Nov 2023 03:08:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 91A8F219D7; Thu, 2 Nov 2023 10:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698919724; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FsbHNsMbfhoTRCwzDvCjMOcypitr1Q8y92FNQVrgWfg=; b=grBBTWxg5BME0R6Tu2BulpWH5XSjwHn1vp2OoFPNtf9flpmDWdFLB+m1moLEh1iKruTdDf KVPqlZCUljod7aMc2lYQ+/7Tb/8NfOEsYm+OqRxs443i1czd683kTsihrqE2WHIWr82pmK Me8FyDPtBn4Sv49b8bktKgAr6IVyTK0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698919724; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FsbHNsMbfhoTRCwzDvCjMOcypitr1Q8y92FNQVrgWfg=; b=4gYfgycFG/zpkor052AeYje+IpLZhkWcpJK7MZkQOfdBJhGaaM8XrXxn2X2LrLk7AuzEsh 48zgfYOyjZz4yBDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8064213584; Thu, 2 Nov 2023 10:08:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id NJpPHyx1Q2W7fgAAMHmgww (envelope-from ); Thu, 02 Nov 2023 10:08:44 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 05A5AA06E3; Thu, 2 Nov 2023 11:08:43 +0100 (CET) Date: Thu, 2 Nov 2023 11:08:43 +0100 From: Jan Kara To: Ojaswin Mujoo Cc: linux-ext4@vger.kernel.org, Theodore Ts'o , Ritesh Harjani , linux-kernel@vger.kernel.org, Jan Kara Subject: Re: [PATCH v2 1/2] ext4: treat end of range as exclusive in ext4_zero_range() Message-ID: <20231102100843.c3byjojrzd62g2di@quack3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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, 02 Nov 2023 03:08:56 -0700 (PDT) On Wed 01-11-23 22:08:10, Ojaswin Mujoo wrote: > 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 Looks good to me. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR