Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2151528iof; Tue, 7 Jun 2022 21:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWOJADm75WxQbctI4PJ4BP9CD24lIQ85RDUAxCmq6B1cpaSwvBLTS9VScdSdDRi7vyCu9L X-Received: by 2002:aa7:864b:0:b0:518:796a:f9bb with SMTP id a11-20020aa7864b000000b00518796af9bbmr32755256pfo.9.1654662534341; Tue, 07 Jun 2022 21:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662534; cv=none; d=google.com; s=arc-20160816; b=XF+EMLdfJpbzHbs0BQXvGiZnqXcd9q8jm9hcD2/2ZgoKYlvJl2ASbiHg0DIg5JtJSp rR6D4M/1WUt8hgff/Ta/0sLmPIC6T//VfJfo4LX6LZmJyLTr5ECRtlD/9QVkJMv90xwr iWTWyx/dD4am+ylJMqcHj8qU6nSZ4ENlYFqCNaH+G4WeJF2Oz/WPIhJ9g/bOHh8vPLaJ SGhgphAs62xaTPYss/BHsMlvgKyCH3NVJIeJUe5xvFd7Ntma+Mv9gdQf6yhwlJnoNh6Z FeAPgXIWfz4MgvCIL/zKZvLjDyoD+9KRX6MfVLz3sSsB76ZqzUO+gnnvNrpbZLQJgvgc 1hDQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F6lCsmNacumzxktqQCdaw0QRrI3H6opm9QhTTXWhyso=; b=NMD4/lvGWTQQyp4Z6IdxG/eVfHkkj4j5ls8sNbtfIcmTsEIgYZZ1cJbNn87/PY97w6 dT21Ivu0uw/JS7AdUjDDG4VUytDFoNYoCry+JXuDMS20bLIB/C0MQJvL5YVl1nFcF73G MsIhNHQTDcc+MRAgqPQg3/UksJDea2jzlPOgN4kSAxtF59DcBmr+SeVL6wWeU83Kckoi CGZjcGiQ3u5rY0zQBtcqzjuZWhJ+7LuFNKTvdwDl6kJK2MfSkG8UhUHh9xeSyAtrKWDr tjkCjqqfvWnL9cIQ1yFOu/FftME9uaVAYC/c09BvrtYRt/nwSLbwbzENKFJNHQmu36sQ sqWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ebM/M2QK"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s137-20020a632c8f000000b003fdbe9d3497si9456439pgs.459.2022.06.07.21.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:28:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ebM/M2QK"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65D6721488F; Tue, 7 Jun 2022 20:58:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383027AbiFGWAw (ORCPT + 99 others); Tue, 7 Jun 2022 18:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377303AbiFGVCo (ORCPT ); Tue, 7 Jun 2022 17:02:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A51EE123883; Tue, 7 Jun 2022 11:48:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C35E4B8239B; Tue, 7 Jun 2022 18:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12A42C385A5; Tue, 7 Jun 2022 18:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627699; bh=0wUPtvcxsDb/X2qUcKd/zlt/iXNEj20UtsVY8xySO5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebM/M2QKZ3ObhQ2hKSB9pjymjUlXMUkgQvluoOjQwRIQXzXGdnVZ3XGNyYS0s2eRI 7XFYMtXSxAGOkwuahU0wYgFyBJvgZQmpYXcRBzddAjB9ZmlSPsjVmbTyzoMuAz/ldF 3vDZ9m6AvIf+xv3AfHVueq4nvK6AQ0d0vJhEEIYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ganapathi Kamath , Kari Argillander , Konstantin Komarov Subject: [PATCH 5.18 024/879] fs/ntfs3: Keep preallocated only if option prealloc enabled Date: Tue, 7 Jun 2022 18:52:22 +0200 Message-Id: <20220607165003.376780972@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Konstantin Komarov commit e95113ed4d428219e3395044e29f5713fc446720 upstream. If size of file was reduced, we still kept allocated blocks. This commit makes ntfs3 work as other fs like btrfs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=214719 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reported-by: Ganapathi Kamath Tested-by: Ganapathi Kamath Reviewed-by: Kari Argillander Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman --- fs/ntfs3/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -495,7 +495,7 @@ static int ntfs_truncate(struct inode *i down_write(&ni->file.run_lock); err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size, - &new_valid, true, NULL); + &new_valid, ni->mi.sbi->options->prealloc, NULL); up_write(&ni->file.run_lock); if (new_valid < ni->i_valid)