From: jiangyiwen Date: Fri, 25 Mar 2016 21:21:35 +0000 (-0700) Subject: ocfs2: solve a problem of crossing the boundary in updating backups X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=584dca3440732afa84fbca07567bb66e1453936a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ocfs2: solve a problem of crossing the boundary in updating backups In update_backups() there exists a problem of crossing the boundary as follows: we assume that lun will be resized to 1TB(cluster_size is 32kb), it will include 0~33554431 cluster, in update_backups func, it will backup super block in location of 1TB which is the 33554432th cluster, so the phenomenon of crossing the boundary happens. Signed-off-by: Yiwen Jiang Reviewed-by: Joseph Qi Cc: Xue jiufei Cc: Mark Fasheh Cc: Joel Becker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c index 576b9a04873f..18451e0fab81 100644 --- a/fs/ocfs2/resize.c +++ b/fs/ocfs2/resize.c @@ -196,7 +196,7 @@ static int update_backups(struct inode * inode, u32 clusters, char *data) for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) { blkno = ocfs2_backup_super_blkno(inode->i_sb, i); cluster = ocfs2_blocks_to_clusters(inode->i_sb, blkno); - if (cluster > clusters) + if (cluster >= clusters) break; ret = ocfs2_read_blocks_sync(osb, blkno, 1, &backup);