Bläddra i källkod

NTFS: Fix a nasty runlist merge bug when merging two holes.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Anton Altaparmakov 20 år sedan
förälder
incheckning
37e4c13b98
2 ändrade filer med 6 tillägg och 2 borttagningar
  1. 2 1
      fs/ntfs/ChangeLog
  2. 4 1
      fs/ntfs/runlist.c

+ 2 - 1
fs/ntfs/ChangeLog

@@ -72,9 +72,10 @@ ToDo/Notes:
 	  runlist.  This allows us to find runlist elements with the runlist
 	  runlist.  This allows us to find runlist elements with the runlist
 	  lock already held without having to drop and reacquire it around the
 	  lock already held without having to drop and reacquire it around the
 	  call.  Adapt all callers.
 	  call.  Adapt all callers.
-	- Change time to u64 time.h::ntfs2utc() as it otherwise generates a
+	- Change time to u64 in time.h::ntfs2utc() as it otherwise generates a
 	  warning in the do_div() call on sparc32.  Thanks to Meelis Roos for
 	  warning in the do_div() call on sparc32.  Thanks to Meelis Roos for
 	  the report and analysis of the warning.
 	  the report and analysis of the warning.
+	- Fix a nasty runlist merge bug when merging two holes.
 
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 2.1.22 - Many bug and race fixes and error handling improvements.
 
 

+ 4 - 1
fs/ntfs/runlist.c

@@ -113,8 +113,11 @@ static inline BOOL ntfs_are_rl_mergeable(runlist_element *dst,
 	BUG_ON(!dst);
 	BUG_ON(!dst);
 	BUG_ON(!src);
 	BUG_ON(!src);
 
 
-	if ((dst->lcn < 0) || (src->lcn < 0))     /* Are we merging holes? */
+	if ((dst->lcn < 0) || (src->lcn < 0)) {   /* Are we merging holes? */
+		if (dst->lcn == LCN_HOLE && src->lcn == LCN_HOLE)
+			return TRUE;
 		return FALSE;
 		return FALSE;
+	}
 	if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */
 	if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */
 		return FALSE;
 		return FALSE;
 	if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */
 	if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */