Ignored unmapped regions when checking whether sparse

Updating an attribute may imply decompressing runlists which are not
contiguous, leaving an unmapped region between them. When checking whether
the attribute has been made sparse, such unmapped regions should be ignored
This mostly happens after updating an index. (fix by Forrest Liu)
edge.strict_endians
Jean-Pierre André 2013-12-17 10:39:55 +01:00
parent 5b38218f0b
commit f0c5c2a54f
1 changed files with 13 additions and 5 deletions

View File

@ -5567,7 +5567,7 @@ retry:
BOOL changed;
if (!(na->data_flags & ATTR_IS_SPARSE)) {
int sparse;
int sparse = 0;
runlist_element *xrl;
/*
@ -5575,10 +5575,18 @@ retry:
* have to check whether there is a hole
* in the updated region.
*/
xrl = na->rl;
if (xrl->lcn == LCN_RL_NOT_MAPPED)
xrl++;
sparse = ntfs_rl_sparse(xrl);
for (xrl = na->rl; xrl->length; xrl++) {
if (xrl->lcn < 0) {
if (xrl->lcn == LCN_HOLE) {
sparse = 1;
break;
}
if (xrl->lcn != LCN_RL_NOT_MAPPED) {
sparse = -1;
break;
}
}
}
if (sparse < 0) {
ntfs_log_error("Could not check whether sparse\n");
errno = EIO;