depmod: prevent module dependency files missing during depmod invocation
authorMichal Suchanek <msuchanek@suse.de>
Mon, 10 Dec 2018 21:29:32 +0000 (22:29 +0100)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 17 Dec 2018 18:19:50 +0000 (10:19 -0800)
depmod deletes the module dependency files before moving the temporary
files in their place. This results in user seeing no dependency files
while they are updated. Remove the unlink call. The rename call should
suffice to move the new file in place and unlink the old one. It should
also do both atomically so there is no window when no dependency file
exists.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
tools/depmod.c

index 989d907..18c0d61 100644 (file)
@@ -2451,7 +2451,6 @@ static int depmod_output(struct depmod *depmod, FILE *out)
                        break;
                }
 
-               unlinkat(dfd, itr->name, 0);
                if (renameat(dfd, tmp, dfd, itr->name) != 0) {
                        err = -errno;
                        CRIT("renameat(%s, %s, %s, %s): %m\n",