diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2006-12-22 04:06:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-22 11:55:47 -0500 |
commit | 92a3d03aab912624cae799e5772a6eb2ef55083f (patch) | |
tree | 6bd85729918e1c56044ad5a1d084838444ab428e | |
parent | ba0084048ab785c2cb1d6cc2cccabe642a5b799a (diff) |
[PATCH] Fix for shmem_truncate_range() BUG_ON()
Ran into BUG() while doing madvise(REMOVE) testing. If we are punching a
hole into shared memory segment using madvise(REMOVE) and the entire hole
is below the indirect blocks, we hit following assert.
BUG_ON(limit <= SHMEM_NR_DIRECT);
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/shmem.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 4bb28d218eb5..70da7a0981bf 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -515,7 +515,12 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end) | |||
515 | size = SHMEM_NR_DIRECT; | 515 | size = SHMEM_NR_DIRECT; |
516 | nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); | 516 | nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); |
517 | } | 517 | } |
518 | if (!topdir) | 518 | |
519 | /* | ||
520 | * If there are no indirect blocks or we are punching a hole | ||
521 | * below indirect blocks, nothing to be done. | ||
522 | */ | ||
523 | if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT))) | ||
519 | goto done2; | 524 | goto done2; |
520 | 525 | ||
521 | BUG_ON(limit <= SHMEM_NR_DIRECT); | 526 | BUG_ON(limit <= SHMEM_NR_DIRECT); |