From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE54DC43334 for ; Tue, 7 Jun 2022 17:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348871AbiFGR4h (ORCPT ); Tue, 7 Jun 2022 13:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349377AbiFGR4N (ORCPT ); Tue, 7 Jun 2022 13:56:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CBC30569; Tue, 7 Jun 2022 10:40:09 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B2A2261529; Tue, 7 Jun 2022 17:39:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB905C385A5; Tue, 7 Jun 2022 17:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623596; bh=VJRyBH7vH9lulJ4xxbCwKEzvFI6nstpYBhWD9hFVqdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYkSHMo0SnqQfyr35OE8WBYcBRtab47LIDKE/Ivkthlud6P+QnXpNlZw6qTw/1glL Fiywdc5nHvVDNL4gw2g3Cy47UJavl+iF7tnkJEVXlNJrZenFTb3azs9erbJrdxrh3f I/ePKkRfl2yaIRZXD9z0/EE76RQ4Mthr+fDuuXAY= 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.15 022/667] fs/ntfs3: Keep preallocated only if option prealloc enabled Date: Tue, 7 Jun 2022 18:54:47 +0200 Message-Id: <20220607164935.460996809@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164934.766888869@linuxfoundation.org> References: <20220607164934.766888869@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -494,7 +494,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)