aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/extents.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 82e239a176c7..4f1d994847bd 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2956,14 +2956,17 @@ again:
2956 if (err < 0) 2956 if (err < 0)
2957 goto out; 2957 goto out;
2958 2958
2959 } else if (sbi->s_cluster_ratio > 1 && end >= ex_end) { 2959 } else if (sbi->s_cluster_ratio > 1 && end >= ex_end &&
2960 partial.state == initial) {
2960 /* 2961 /*
2961 * If there's an extent to the right its first cluster 2962 * If we're punching, there's an extent to the right.
2962 * contains the immediate right boundary of the 2963 * If the partial cluster hasn't been set, set it to
2963 * truncated/punched region. Set partial_cluster to 2964 * that extent's first cluster and its state to nofree
2964 * its negative value so it won't be freed if shared 2965 * so it won't be freed should it contain blocks to be
2965 * with the current extent. The end < ee_block case 2966 * removed. If it's already set (tofree/nofree), we're
2966 * is handled in ext4_ext_rm_leaf(). 2967 * retrying and keep the original partial cluster info
2968 * so a cluster marked tofree as a result of earlier
2969 * extent removal is not lost.
2967 */ 2970 */
2968 lblk = ex_end + 1; 2971 lblk = ex_end + 1;
2969 err = ext4_ext_search_right(inode, path, &lblk, &pblk, 2972 err = ext4_ext_search_right(inode, path, &lblk, &pblk,