On Thu, 2020-05-14 at 20:59 -0500, Benjamin Marzinski wrote: > The (is|mark|unmark)_failed_wwid code is needlessly complicated. > Locking a file is necssary if multiple processes could otherwise be > writing to it at the same time. That is not the case with the > failed_wwids files. They can simply be empty files in a > directory. Even > with all the locking in place, two processes accessing or modifying a > file at the same time will still race. And even without the locking, > if > two processes try to access or modify a file at the same time, they > will > both see a reasonable result, and will leave the files in a valid > state > afterwards. > > Instead of doing all the locking work (which made it necessary to > write > a file, even just to check if a file existed), simply check for files > with lstat(), create them with open(), and remove them with unlink(). > > Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> With the follow-up (6/6): Reviewed-by: Martin Wilck <mwilck@xxxxxxxx> -- Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107 SUSE Software Solutions Germany GmbH HRB 36809, AG Nürnberg GF: Felix Imendörffer -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel