> + if (ns->ns_id > nsid) { > + list_del_init(&ns->list); > + list_add_tail(&ns->list, &rm_list); > + } This should use list_move_tail instead of the list_del_init / list_add_tail combination.