Skip to content

Commit 07ccb7b

Browse files
committed
GFS2: Fix bmap allocation corner-case bug
This patch solves a corner case during allocation which occurs if both metadata (indirect) and data blocks are required but there is an obstacle in the filesystem (e.g. a resource group header or another allocated block) such that when the allocation is requested only enough blocks for the metadata are returned. By changing the exit condition of this loop, we ensure that a minimum of one data block will always be returned. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 0e5a9fb commit 07ccb7b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/gfs2/bmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
541541
*ptr++ = cpu_to_be64(bn++);
542542
break;
543543
}
544-
} while (state != ALLOC_DATA);
544+
} while ((state != ALLOC_DATA) || !dblock);
545545

546546
ip->i_height = height;
547547
gfs2_add_inode_blocks(&ip->i_inode, alloced);

0 commit comments

Comments
 (0)