Skip to content

Commit 37e4c13

Browse files
NTFS: Fix a nasty runlist merge bug when merging two holes.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
1 parent d8ec785 commit 37e4c13

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎fs/ntfs/ChangeLog‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ ToDo/Notes:
7272
runlist. This allows us to find runlist elements with the runlist
7373
lock already held without having to drop and reacquire it around the
7474
call. Adapt all callers.
75-
- Change time to u64 time.h::ntfs2utc() as it otherwise generates a
75+
- Change time to u64 in time.h::ntfs2utc() as it otherwise generates a
7676
warning in the do_div() call on sparc32. Thanks to Meelis Roos for
7777
the report and analysis of the warning.
78+
- Fix a nasty runlist merge bug when merging two holes.
7879

7980
2.1.22 - Many bug and race fixes and error handling improvements.
8081

‎fs/ntfs/runlist.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ static inline BOOL ntfs_are_rl_mergeable(runlist_element *dst,
113113
BUG_ON(!dst);
114114
BUG_ON(!src);
115115

116-
if ((dst->lcn < 0) || (src->lcn < 0)) /* Are we merging holes? */
116+
if ((dst->lcn < 0) || (src->lcn < 0)) { /* Are we merging holes? */
117+
if (dst->lcn == LCN_HOLE && src->lcn == LCN_HOLE)
118+
return TRUE;
117119
return FALSE;
120+
}
118121
if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */
119122
return FALSE;
120123
if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */

0 commit comments

Comments
 (0)