[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210109224054.5694-3-magnani@ieee.org>
Date: Sat, 9 Jan 2021 16:40:54 -0600
From: Steve Magnani <magnani@...e.org>
To: Jan Kara <jack@...e.com>
Cc: linux-kernel@...r.kernel.org,
"Steven J . Magnani" <magnani@...e.org>
Subject: [PATCH 2/2] udf: fix File Tail reclaim following hole append
From: Steven J. Magnani <magnani@...e.org>
Adjust bookkeeping during creation of an end-of-file hole to ensure that
any File Tail (preallocated extent) is reclaimed when the file is
released.
This also ensures that the file's Extended File Entry is populated with
the proper count of recorded blocks.
Fixes: fa33cdbf3ece ("udf: Fix incorrect final NOT_ALLOCATED (hole) extent length")
Signed-off-by: Steven J. Magnani <magnani@...e.org>
---
--- a/fs/udf/inode.c 2020-12-28 20:51:29.000000000 -0600
+++ b/fs/udf/inode.c 2021-01-03 07:04:05.759911829 -0600
@@ -535,6 +535,7 @@ static int udf_do_extend_file(struct ino
add = new_block_bytes;
new_block_bytes -= add;
last_ext->extLength += add;
+ iinfo->i_lenExtents += add;
}
if (fake) {
@@ -571,6 +572,7 @@ static int udf_do_extend_file(struct ino
last_ext->extLength, 1);
if (err)
return err;
+ iinfo->i_lenExtents += add;
count++;
}
if (new_block_bytes) {
@@ -580,6 +582,7 @@ static int udf_do_extend_file(struct ino
last_ext->extLength, 1);
if (err)
return err;
+ iinfo->i_lenExtents += new_block_bytes;
count++;
}
@@ -682,7 +685,6 @@ static int udf_extend_file(struct inode
if (err < 0)
goto out;
err = 0;
- iinfo->i_lenExtents = newsize;
out:
brelse(epos.bh);
return err;
Powered by blists - more mailing lists