From patchwork Mon Dec 10 21:29:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 10722563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF2A61751 for ; Mon, 10 Dec 2018 21:29:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2582A276 for ; Mon, 10 Dec 2018 21:29:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF9452A243; Mon, 10 Dec 2018 21:29:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 527D52A243 for ; Mon, 10 Dec 2018 21:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbeLJV3v (ORCPT ); Mon, 10 Dec 2018 16:29:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:35786 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727818AbeLJV3v (ORCPT ); Mon, 10 Dec 2018 16:29:51 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2F834AECF for ; Mon, 10 Dec 2018 21:29:50 +0000 (UTC) From: Michal Suchanek To: linux-modules@vger.kernel.org Cc: Michal Suchanek Subject: [PATCH v2 1/3] depmod: prevent module dependency files missing during depmod invocation. Date: Mon, 10 Dec 2018 22:29:32 +0100 Message-Id: X-Mailer: git-send-email 2.19.2 In-Reply-To: References: MIME-Version: 1.0 Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 --- tools/depmod.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/depmod.c b/tools/depmod.c index 989d9077926c..18c0d61b2db3 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -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",