From 4b8a66000690c1e7c8393728a60ca78379d0b838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 18 Nov 2020 11:33:49 +0100 Subject: [PATCH] Fixed maintining the allocated size when updating sparse files When filling a hole in a sparse file, the beginning of the runlist does not need to be updated. However the allocated size is within the extent holding its beginning and it needs to be updated. --- libntfs-3g/attrib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 7d5d5374..a736a9a2 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -5,7 +5,7 @@ * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2002-2008 Szabolcs Szakacsits * Copyright (c) 2004-2007 Yura Pakhuchiy - * Copyright (c) 2007-2015 Jean-Pierre Andre + * Copyright (c) 2007-2020 Jean-Pierre Andre * Copyright (c) 2010 Erik Larsson * * This program/include file is free software; you can redistribute it and/or @@ -5850,6 +5850,9 @@ retry: & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); if (spcomp) a->compressed_size = cpu_to_sle64(na->compressed_size); + /* Updating sizes taints the extent holding the attr */ + if (ctx->ntfs_ino) + NInoSetDirty(ctx->ntfs_ino); if ((na->type == AT_DATA) && (na->name == AT_UNNAMED)) { na->ni->allocated_size = (spcomp