enlarge INDEX_ROOT if ATTRIBUTE_LIST addition will be avoidable

master
szaka 2009-03-22 13:32:34 +00:00
parent 6b04b569ee
commit 31a807d4fd
2 changed files with 17 additions and 5 deletions

View File

@ -3400,6 +3400,14 @@ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size)
"(%u > %u)\n", new_muse, alloc_size);
return -1;
}
if (a->type == AT_INDEX_ROOT && new_size > attr_size &&
new_muse + 120 > alloc_size) {
errno = ENOSPC;
ntfs_log_trace("Too big INDEX_ROOT (%u > %u)\n",
new_muse, alloc_size);
return -1;
}
/* Move attributes following @a to their new location. */
memmove((u8 *)a + new_size, (u8 *)a + attr_size,

View File

@ -1228,12 +1228,16 @@ static int ntfs_ir_make_space(ntfs_index_context *icx, int data_size)
int ret;
ntfs_log_trace("Entering\n");
ret = ntfs_ir_truncate(icx, data_size);
if (ret == STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT) {
ret = ntfs_ir_reparent(icx);
if (ret == STATUS_OK)
ret = STATUS_KEEP_SEARCHING;
else
ntfs_log_perror("Failed to nodify INDEX_ROOT");
ret = ntfs_ir_reparent(icx);
if (ret == STATUS_OK)
ret = STATUS_KEEP_SEARCHING;
else
ntfs_log_perror("Failed to nodify INDEX_ROOT");
}
return ret;
}