ocfs2: Solve a problem of crossing the boundary in updating backups
PATCH 1/1 ocfs2: Solve a problem of crossing the boundary in updating backups
In update_backups func, it 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 is happened.
--- fs/ocfs2/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/resize.c +1 -1
@@ -187,7 +187,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);
Signature · 1 line
1.8.4.3
PATCH 1/1 ocfs2: Solve a problem of crossing the boundary in updating backups
Quoted 8 lines · jiangyiwen
In
update_backupsfunc, it 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, inupdate_backupsfunc, it will backup super block in location of 1TB which is the 33554432th cluster, so the phenomenon of crossing the boundary is happened.Signed-off-by Yiwen Jiang <[email protected]>
Quoted 18 lines
--- fs/ocfs2/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ocfs2/resize.c +1
-1@@ -187,7 +187,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);