Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp411916rdb; Thu, 19 Oct 2023 08:01:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI8hBAh/dX9cV89RMu27romzyc/ttmvZASk655YGFPrCP3GEx1u7P8IfsfXabJlqbeRtfk X-Received: by 2002:a05:6a20:5d93:b0:169:9802:fd72 with SMTP id km19-20020a056a205d9300b001699802fd72mr1696894pzb.62.1697727682204; Thu, 19 Oct 2023 08:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697727682; cv=none; d=google.com; s=arc-20160816; b=m4Ye4ExeRQsV3WhdBKEV+h8vBf+yIBAo3bPSOoVrHnM85uN9NXMCuZZTj96N42HKW1 QpUyXf+MDcA0c2YKSdi5nssayMtIOO6FTZQLxx3eGJw02KjGKP8glY47uwuwJjzcdImt WL4A3t3lc9M2ScQwPa0eFLKw8txhWBJGrwpdjacBB7AttP9u/dR4O8TFmEBHPEYwYHpL tvlX26QVyK/P/wJAZvgGIEKAhHkDzX7LefQ7nRSgaka663IWYJgWDWKEpkvmXo89ERbL O23AjaJsUEt2QFnw28cw7PRT9aSgt6qkxGdQuUtEN8IhB0OeXQTP4YmOJ2l/4b1N4cUE U5rA== 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=2SADzQbXtqkn9LOo3Wunl1TnxEcgZDEc3CMwdG9777M=; fh=9YeD+/1Lt1hy1WwsFf2xgL+JaQVwRkyLtT/FOmbm2fg=; b=gtZXxG8pev3wgisUbZVinyvCSPmsrkO+UoZPYVnUqd6JAbnZUJwdKyzY1r9AjPvgmS g1sl6UKHSHfaMjzOFBF1sKssaviRe0bRDt50gorcIn4Mei+bNs3etwZZROEeFRiP9/Kv KmQOMKhiZLs9iGRn5C8Z81QidB03Po9QpoP78a28rU3FjgD2kaY+3I1A4B3r8p+EihNB ML/R0bRoXivZYEjkLlH7bualimumWzlTh1jmwBECrlS5W6nBI4HUEkHFZxaL6tqTHXHr u4zv72efR+qWO1HdFk5UPx/RIXde0qJxKuXbw59g92maW/m18NTmUtvG0/aW+WI1D/am pPmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=jMZr9lKq; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l193-20020a633eca000000b005aa998ea599si4584493pga.510.2023.10.19.08.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 08:01:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=jMZr9lKq; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8C94F8246874; Thu, 19 Oct 2023 08:01:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346220AbjJSPBN (ORCPT + 99 others); Thu, 19 Oct 2023 11:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346213AbjJSPBM (ORCPT ); Thu, 19 Oct 2023 11:01:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF4612D; Thu, 19 Oct 2023 08:01:10 -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-out2.suse.de (Postfix) with ESMTPS id ACAA81F38C; Thu, 19 Oct 2023 15:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697727668; 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=2SADzQbXtqkn9LOo3Wunl1TnxEcgZDEc3CMwdG9777M=; b=jMZr9lKq+QJOvrSVspMNHHG/bGyg90ankhdpBioWXjc14b31w1WCMAypaFHGGG8qp4+c2f 5iGpfQbZegdEdrBhtAvB/qPzjd9vDKuYIPE9DrO7kPt7tjWIbtETMCmI+YUB7pm0raBqkg hOzKHbl+6lQ42HLDPm4wZfvI/rswDqc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697727668; 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=2SADzQbXtqkn9LOo3Wunl1TnxEcgZDEc3CMwdG9777M=; b=14zUj++VCY0+amgmyGpQ0O8k26TB12OZih5Ckngf4GgXRpZS5ekUkeBAeolDV8EookLgaC FM9cCRBYfAw17dBg== 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 9C0A51357F; Thu, 19 Oct 2023 15:01:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id BqkIJrREMWX3FAAAMHmgww (envelope-from ); Thu, 19 Oct 2023 15:01:08 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 10357A0550; Thu, 19 Oct 2023 17:01:08 +0200 (CEST) Date: Thu, 19 Oct 2023 17:01:08 +0200 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 1/3] ext4: treat end of range as exclusive in ext4_zero_range() Message-ID: <20231019150108.mwzinguhn6zxrzbu@quack3> References: <9ae3bf53e81554cec3e609de8e8939b90966f7ab.1695987265.git.ojaswin@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ae3bf53e81554cec3e609de8e8939b90966f7ab.1695987265.git.ojaswin@linux.ibm.com> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-3.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; FREEMAIL_CC(0.00)[vger.kernel.org,mit.edu,gmail.com,suse.cz] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 19 Oct 2023 08:01:16 -0700 (PDT) On Fri 29-09-23 19:40:43, 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 Yes, makes sense. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR