Fix EOF extent in last block

Currently if there is an extent on the last block the code will only set
EOF on ENOENT. In the case that the last block has an extent it wont go
to the next iteration due to iblock <= last. This then doesnt set the EOF
on the last block in these cases. We want to just allow the loop to keep
looping and rely on if (ext.start > last) to protect us from infinite loop.
This commit is contained in:
Bryant Duffy-Ly
2022-03-25 09:50:16 -05:00
committed by Bryant G. Duffy-Ly
parent 20370c6573
commit bb11617fe3
+4 -3
View File
@@ -1748,13 +1748,14 @@ int scoutfs_data_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
iblock = start >> SCOUTFS_BLOCK_SM_SHIFT;
last = (start + len - 1) >> SCOUTFS_BLOCK_SM_SHIFT;
while (iblock <= last) {
while (true) {
ret = scoutfs_ext_next(sb, &data_ext_ops, &args,
iblock, 1, &ext);
if (ret < 0) {
if (ret == -ENOENT)
if (ret == -ENOENT) {
ret = 0;
last_flags = FIEMAP_EXTENT_LAST;
last_flags = FIEMAP_EXTENT_LAST;
}
break;
}