mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cmsfs-fuse: fix pointer block level calculation
Adding one to the pointer per block value results in a wrong calculation of pointer block levels. When writing a file that would result in about 454MB size, the code would calculate that it needs a two level pointer directory but correct would be a three level pointer directory. This causes an invalid filesystem state: besides missing all the records of one top level pointer directory entry, it would also record a higher record number in the FST than what is present in the pointer blocks. Note that this bug only hits when the file is about 454MB and the write is stopped (means the file is closed) - if file writing continues the problem doesn't happen because at some point in time cmsfs-fuse would switch to three levels of pointer blocks anyways as the file grows. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
148d3f9b64
commit
2f154fa49d
@@ -2050,7 +2050,7 @@ static int update_dir_levels(int blocks)
|
||||
if (blocks < 2)
|
||||
return 0;
|
||||
|
||||
while (blocks / (PTRS_PER_BLOCK + 1)) {
|
||||
while (blocks / PTRS_PER_BLOCK) {
|
||||
levels++;
|
||||
blocks /= PTRS_PER_BLOCK;
|
||||
}
|
||||
@@ -3103,7 +3103,7 @@ static void update_levels(struct file *f)
|
||||
return;
|
||||
}
|
||||
|
||||
while (blocks / (per_block + 1)) {
|
||||
while (blocks / per_block) {
|
||||
levels++;
|
||||
blocks /= per_block;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user