Commit 1d58b27b authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Change the runlist terminator of the newly allocated cluster(s) to

      LCN_ENOENT in ntfs_attr_make_non_resident().  Otherwise the runlist
      code gets confused.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 3bd1f4a1
...@@ -132,6 +132,9 @@ ToDo/Notes: ...@@ -132,6 +132,9 @@ ToDo/Notes:
with a 64-bit variable and a int, i.e. 32-bit, constant. This causes with a 64-bit variable and a int, i.e. 32-bit, constant. This causes
the higher order 32-bits of the 64-bit variable to be zeroed. To fix the higher order 32-bits of the 64-bit variable to be zeroed. To fix
this cast the 'const' to the same 64-bit type as 'var'. this cast the 'const' to the same 64-bit type as 'var'.
- Change the runlist terminator of the newly allocated cluster(s) to
LCN_ENOENT in ntfs_attr_make_non_resident(). Otherwise the runlist
code gets confused.
2.1.22 - Many bug and race fixes and error handling improvements. 2.1.22 - Many bug and race fixes and error handling improvements.
......
...@@ -1285,6 +1285,8 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni) ...@@ -1285,6 +1285,8 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni)
new_size = (i_size_read(vi) + vol->cluster_size - 1) & new_size = (i_size_read(vi) + vol->cluster_size - 1) &
~(vol->cluster_size - 1); ~(vol->cluster_size - 1);
if (new_size > 0) { if (new_size > 0) {
runlist_element *rl2;
/* /*
* Will need the page later and since the page lock nests * Will need the page later and since the page lock nests
* outside all ntfs locks, we need to get the page now. * outside all ntfs locks, we need to get the page now.
...@@ -1304,6 +1306,12 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni) ...@@ -1304,6 +1306,12 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni)
err); err);
goto page_err_out; goto page_err_out;
} }
/* Change the runlist terminator to LCN_ENOENT. */
rl2 = rl;
while (rl2->length)
rl2++;
BUG_ON(rl2->lcn != LCN_RL_NOT_MAPPED);
rl2->lcn = LCN_ENOENT;
} else { } else {
rl = NULL; rl = NULL;
page = NULL; page = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment