diff options
-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 db21c51531c..7013af1bcd0 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -510,7 +510,12 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end) size = SHMEM_NR_DIRECT; nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); } - if (!topdir) + + /* + * If there are no indirect blocks or we are punching a hole + * below indirect blocks, nothing to be done. + */ + if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT))) goto done2; BUG_ON(limit <= SHMEM_NR_DIRECT); |