In the function nova_background_clean_snapshot_list, some situations will arise "unknown type" error. For example, after deletion some snapshots, if the snapshot list looks like below:
If go the next page, just continue the while loop. The tail and the epoch id conditions will be checked by the while loop.
/* for both Line 132 - 137 in function nova_delete_snapshot_list_entries */
if (goto_next_list_page(sb, curr_p)) {
curr_p = next_list_page(curr_p);
continue;
}
/* for Line 217 - 226 in nova_background_clean_snapshot_list */
if (goto_next_list_page(sb, curr_p)) {
curr_p = next_list_page(curr_p);
curr_page = (struct nova_inode_log_page *)curr_p;
continue;
}
Issue
In the function
nova_background_clean_snapshot_list
, some situations will arise "unknown type" error. For example, after deletion some snapshots, if the snapshot list looks like below:The process will ignore the NEXT_PAGE flag in the first entry of the second page, and keep going to access invalid entries in the second page.
Reproduce
Reason
https://github.com/NVSL/linux-nova/blob/b817ca322e6fc61f532174e7effc4b6c81528e3f/fs/nova/snapshot.c#L217-L253 At Line 220,
curr_p
is the first entry of a page. The function checks if this entry is the tail or it has a larger epoch id at Line 221 and 224. Then, it gets the type of this entry andswitch case
it. So, if the type is "NEXT_PAGE", it will cause the error at Line 247.Similar issues at Line 132 - 137 in the function
nova_delete_snapshot_list_entries
. https://github.com/NVSL/linux-nova/blob/b817ca322e6fc61f532174e7effc4b6c81528e3f/fs/nova/snapshot.c#L132-L137Fix
If go the next page, just continue the while loop. The tail and the epoch id conditions will be checked by the while loop.