[LU-14423] osd_is_mapped() does not recognize holes Created: 11/Feb/21 Updated: 07/Nov/22 Resolved: 26/Feb/21 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.15.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Alex Zhuravlev | Assignee: | Alex Zhuravlev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
|
ldiskfs_fiemap() can return a hole in form {0,0,0}and then the following construction recognizes this as an allocated space:
if (start > block) {
cached_extent->start = block;
cached_extent->end = start;
cached_extent->mapped = 0;
} else {
cached_extent->start = start;
cached_extent->end = (fe.fe_logical + fe.fe_length) >>
inode->i_blkbits;
cached_extent->mapped = 1;
}
|
| Comments |
| Comment by Gerrit Updater [ 11/Feb/21 ] |
|
Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/41481 |
| Comment by Andreas Dilger [ 11/Feb/21 ] |
|
Alex, AFAIK FIEMAP should not be returning 0,0,0 as a hole. That is just an uninitialized buffer and should be outside the number of returned extents? Holes in the file should just be skipped in the returned extents. |
| Comment by Alex Zhuravlev [ 11/Feb/21 ] |
|
hmm, this is what I exactly got using linux-3.10.0-957.12.2.el7 - ldiskfs_fiemap() returned 0 and {.fe_logical=0, fe_length=0} for non-allocated block. |
| Comment by Andreas Dilger [ 11/Feb/21 ] |
|
What did it return for the extent count? This may be a bug in ldiskfs. |
| Comment by Alex Zhuravlev [ 11/Feb/21 ] |
fei.fi_extents_mapped was not touched in this case. i.e. it would be 0 for the first call to ldiskfs_fiemap() and 1 if the previous call found an extemt. |
| Comment by Alex Zhuravlev [ 11/Feb/21 ] |
|
AFAICS, fiemap can't return an extent covering a hole to EOF? thus we'd have to lookup each block separately? |
| Comment by Andreas Dilger [ 11/Feb/21 ] |
|
Correct - FIEMAP does not return anything for a hole. If there are no blocks allocated to a file at all, then it should return no extent in that case. I guess you could use the 0,0 return to detect that, though it is a bit non-standard. |
| Comment by Gerrit Updater [ 26/Feb/21 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/41481/ |
| Comment by Peter Jones [ 26/Feb/21 ] |
|
Landed for 2.15 |
| Comment by Gerrit Updater [ 09/Nov/21 ] |
|
"Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/45504 |
| Comment by Gerrit Updater [ 14/Nov/21 ] |
|
"Andreas Dilger <adilger@whamcloud.com>" merged in patch https://review.whamcloud.com/45504/ |