On Thu, 2023-09-07 at 09:24 +0200, Martin Wilck wrote: > On Wed, 2023-09-06 at 17:42 -0500, Benjamin Marzinski wrote: > > On Fri, Sep 01, 2023 at 08:02:17PM +0200, mwilck@xxxxxxxx wrote: > > > > > > Again, unless I'm overlooking something, I don't think we need to > > check if the alias is already taken here. Since we know that a > > device > > already exists with alias_old and the correct WWID, as long as > > alias_old > > is a valid user_friendly_name we can just use it. > > Similar reasoning as above. We could perhaps remove these checks, but > we'd need to replace them by comments explaining why this condition > can't occur. > > We could (and maybe should) move the call to find_existing_alias() > from > add_map_with_path() to get_user_friendly_alias(), so that we have the > entire alias logic in a single place. The mpp->alias_old field would > then only be used for ACT_RENAME. Well, if we do this, we would need to pass vecs->mpvec to get_user_friendly_alias(), which means that we could use it also for the alias_already_taken() check. It's not exactly the same because in one case we look at internal state and in the other case at kernel state. OTOH, we do trust that the two are in agreement, right? And we derive alias_old from the mpvec today, anyway. Do you agree? Regards Martin -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel