Skip to content

Commit

Permalink
NTFS: Change the runlist terminator of the newly allocated cluster(s) to
Browse files Browse the repository at this point in the history
      LCN_ENOENT in ntfs_attr_make_non_resident().  Otherwise the runlist
      code gets confused.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
  • Loading branch information
Anton Altaparmakov committed Jun 25, 2005
1 parent 3bd1f4a commit 1d58b27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/ntfs/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ ToDo/Notes:
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
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.

Expand Down
8 changes: 8 additions & 0 deletions fs/ntfs/attrib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,8 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni)
new_size = (i_size_read(vi) + vol->cluster_size - 1) &
~(vol->cluster_size - 1);
if (new_size > 0) {
runlist_element *rl2;

/*
* Will need the page later and since the page lock nests
* outside all ntfs locks, we need to get the page now.
Expand All @@ -1304,6 +1306,12 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni)
err);
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 {
rl = NULL;
page = NULL;
Expand Down

0 comments on commit 1d58b27

Please sign in to comment.