From patchwork Fri Jan 12 16:37:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 860040 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bd50J2X9"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zJ7hj0qPrz9s7M for ; Sat, 13 Jan 2018 03:37:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6199610FF; Fri, 12 Jan 2018 16:37:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 37AD210FD for ; Fri, 12 Jan 2018 16:37:51 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EA328477 for ; Fri, 12 Jan 2018 16:37:49 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id j3so4769402pfh.8 for ; Fri, 12 Jan 2018 08:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=a/+xwSEXPPr4xDNTIN0WBaO5b5YDYia1StUNXnAIhTU=; b=bd50J2X9M2dR/P+7ZIfY+2pDx2l6ylCCDzpjLfdv40e1ck4fJWf6bN68mufbrT5ZGs 73UA/gLXpC2K11prB3uR8g/VZB0byMRBKGKq1mY+7SG71n3N4/JLhXBJeZDXcnIEImju 56JG3XVbtNYD2o0sfFrA2q3IegH8pAeO7XU0bui0epZRVA7r2gA5lc0nVG0Fvk/kxQes qA0s7mVogqrILkRwCxc61qFY403r0R4ohm48zlny9bopaTUFSeM1B9ujIuATTuDefh5p 9KZn6WjBeX907WIzbJ1EESnU51TttV2SUZEC2BzIG7oWjdkeDF4+aYRAcBRIopLJIetm 6AyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=a/+xwSEXPPr4xDNTIN0WBaO5b5YDYia1StUNXnAIhTU=; b=SqEdMiN/I41+7qiziPZbGHlvWxNnppoesqKiVamAeeJL4LouNpTjHrmiVA4+1g4akf uTeK/blz5a4bfV3XYN6R8fMfAcNBlm6k1TBZju1KI80qSXdsayZfOk+RfXCcHL5e8YhY rGr4dLCPLiHypgGKQOzGq5x96v7Y/AMSYae+wsn5MzaZBNhXl3YRYm9jGmkjKnXBwn3X Jt3VZhtTxMilgw03UJt3t/gaPU2e2e/4KTJHaJ4cpqt/g+pNI4i9ETY5pLUwxZYTovfS Eg108aMXsMcEoT3uNoXPY0T/yCQ6tVFpyz+a8QvPx3l8IXXQXn0joiZagUW0fl/snA2A Cp9w== X-Gm-Message-State: AKGB3mLfKLs+dEyZ4S5/uyck90kGqv3LD4f/yZCql7lu50t5CKo2Jzo6 8SeLsPQLplXnsYMxmveg1/+/qw== X-Google-Smtp-Source: ACJfBou/EskQ5dRY1z5sr/wI+i0c1Bx8UPsXks1YinJuBh/PhN2nhDOm3CVFcOVsdkgNKAK8Q7I/QQ== X-Received: by 10.84.128.106 with SMTP id 97mr22700396pla.73.1515775068934; Fri, 12 Jan 2018 08:37:48 -0800 (PST) Received: from gizo.domain (184-100-156-182.ptld.qwest.net. [184.100.156.182]) by smtp.gmail.com with ESMTPSA id x84sm19330684pfe.81.2018.01.12.08.37.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 08:37:48 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 12 Jan 2018 08:37:43 -0800 Message-Id: <1515775064-18494-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Gurucharan Shetty Subject: [ovs-dev] [PATCH V2 1/2] rhel: Add depmod file for openvswitch module search X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Gurucharan Shetty There are occasions when an openvswitch kernel module rpm which does not match the exact build number of the running kernel. In that case the openvswitch kernel modules will be installed to the "weak-updates" directory under the /lib/modules/$(uname -r) directory. But the new kernel modules will not be found because the default /etc/depmod.d/dist.conf search path lists weak-updates last. This patch creates a file in /etc/depmod.d/ named 01openvswitch.conf. This file specifies weak-updates first in the search path and since it is named with a preceeding "01" it will be found first by depmod. This resolves issues with customers who have installed openvswitch kernel modules previously and a kernel upgrade has occurred since and when the kernel minor build numbers do not exactly match the running kernel. Signed-off-by: Greg Rose Signed-off-by: Gurucharan Shetty Signed-off-by: Gurucharan Shetty --- V2 - Fix typo in commit title --- rhel/openvswitch-kmod-rhel6.spec.in | 10 ++++++---- rhel/openvswitch-kmod.files | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rhel/openvswitch-kmod-rhel6.spec.in b/rhel/openvswitch-kmod-rhel6.spec.in index 8413b25..a7f4832 100644 --- a/rhel/openvswitch-kmod-rhel6.spec.in +++ b/rhel/openvswitch-kmod-rhel6.spec.in @@ -62,17 +62,19 @@ for flavor in %flavors_to_build ; do find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; done install -d %{buildroot}%{_sysconfdir}/depmod.d/ + +echo "search extra/openvswitch weak-updates/openvswitch updates extra built-in weak-updates" >> 01%{oname}.conf for module in %{buildroot}/lib/modules/%{kernel_version}/$INSTALL_MOD_DIR/*.ko; do modname="$(basename ${module})" - echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf - echo "override ${modname%.ko} * weak-updates/%{oname}" >> %{oname}.conf + echo "override ${modname%.ko} * extra/%{oname}" >> 01%{oname}.conf + echo "override ${modname%.ko} * weak-updates/%{oname}" >> 01%{oname}.conf done -install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/ +install -m 644 01%{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/ %files %defattr(644,root,root) -/etc/depmod.d/%{oname}.conf +/etc/depmod.d/01%{oname}.conf %clean rm -rf $RPM_BUILD_ROOT diff --git a/rhel/openvswitch-kmod.files b/rhel/openvswitch-kmod.files index 357c2e8..49262f3 100644 --- a/rhel/openvswitch-kmod.files +++ b/rhel/openvswitch-kmod.files @@ -1,3 +1,3 @@ %defattr(644,root,root,755) /lib/modules/%2-%1 -/etc/depmod.d/openvswitch.conf +/etc/depmod.d/01openvswitch.conf From patchwork Fri Jan 12 16:37:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 860041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uGvguciE"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zJ7j25tjtz9s7M for ; Sat, 13 Jan 2018 03:38:14 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6E78F1113; Fri, 12 Jan 2018 16:37:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8EFEE10FD for ; Fri, 12 Jan 2018 16:37:51 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 45F5418A for ; Fri, 12 Jan 2018 16:37:51 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id t12so4769306pfg.2 for ; Fri, 12 Jan 2018 08:37:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uZdEOx5jWpT4+ei0kbbtGMtC/8G/IzVkT4Je4t6EbN8=; b=uGvguciE5PWzTGCYZqLm1I2gdwvodHv0lTyl44OttkI2OKaGH7dT0m79tEr+f9Vx7L 3yrqAci9GCcxh0KFxqs4h9RTsstC50UYwMWp1wMxJAKMzbANDT77PoeQuVURqkynnOvd iEytr+z2tILNq3iio8nsS4/ejdbncqIFzMza9lLbOUtYpVVwGxb+yzymkAsk9W4fLhAz dm11re+FaiOSdxZaSYBocjX6GviJsP1DtgsyOct3njB9jKbId490PiEKN+aL+ksXinnO /q+ZCbfB5XEtUCwzws62LmdTxO7etKWSk9Pv2sgJwW8yXpfCJxWfjB/JmoWMa9FE9SHx Hokw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uZdEOx5jWpT4+ei0kbbtGMtC/8G/IzVkT4Je4t6EbN8=; b=eK52uVjk/nl9JcxSzg4wko27eIbkY+OD1BmB5pJyh+pxsgfjmTbQKSKkzDY/QyLKqj 3Hpn2DVlQvPHJ9vK5Y/ihx31fGcvz7MonsKuF1YDCje3tcTHnlysyKqtjXPMYz27HRo7 rc2pNhX5M8Fg478MrrjLDxtD1pnH2nGg5/OgcU5k6zkRsjZtcK+ALmzYXC/sk1eZaAA7 U2kPK5W+kT+lYTZs7vQzqk6RiFcNM5b6D1FBhqZuBdXRk3w08IDtAPz0qNIGC4k/aWna dB9Vop7bNcwv4YvuiQsTJI9aTlDiF/FgqMC3lxQ+maeuyX4SP7XUku1CXQE0NR8HsXjW YAqw== X-Gm-Message-State: AKwxytfkilXIM3JbI58RMZkURAbU1+n6h5MRJ0igVD+t5VNs4IPX8v44 egpflZorUa1c6D2s5eBrcRYoxQ== X-Google-Smtp-Source: ACJfBoukuIu/nR1LtMeyJdJ8G2Zq2XCeU2ev8wseW4/Z7kUUaOCKEyqmJpinzaI8xI//JT0kWB0a6w== X-Received: by 10.84.235.73 with SMTP id g9mr2336252plt.9.1515775070471; Fri, 12 Jan 2018 08:37:50 -0800 (PST) Received: from gizo.domain (184-100-156-182.ptld.qwest.net. [184.100.156.182]) by smtp.gmail.com with ESMTPSA id x84sm19330684pfe.81.2018.01.12.08.37.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 08:37:49 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 12 Jan 2018 08:37:44 -0800 Message-Id: <1515775064-18494-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515775064-18494-1-git-send-email-gvrose8192@gmail.com> References: <1515775064-18494-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH V2 2/2] rhel: Add post installation check for kernel modules X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org A bug in RHEL 7.2 has been found in which a customer who installed a RHEL 7.2 openvswitch kernel module rpm with a slightly different minor build number than the running kernel found that the kernel modules were installed to the wrong directory. After the installation the new openvswitch kernel modules were installed to: /lib/modules/3.10.0-327.22.2.el7.x86_64/extra/openvswitch But the running kernel was 3.10.0-327.el7.x86_64 and after the installation was complete the kernel modules in the installed directory were not linked to the "weak-updates" directory in the running kernel. So a critical bug was encountered in which the in-tree openvswitch kernel module was loaded instead of the one the customer explicitly installed with the rpm. This patch replicates ./extra/openvswitch directory with kernel modules, if for the currently running kernel there is neither a ./extra/openvswitch nor ./weak-update/openvswitch directory. Signed-off-by: Greg Rose --- V2 - Incorporate feedback from V1 --- rhel/openvswitch.spec.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in index e510d35..b5b5122 100644 --- a/rhel/openvswitch.spec.in +++ b/rhel/openvswitch.spec.in @@ -169,6 +169,32 @@ fi /sbin/chkconfig --add openvswitch /sbin/chkconfig openvswitch on +# In some cases a kernel module rpm will have a different minor build +# version than the currently running kernel. In this case the kernel +# modules will be installed but not to the kernel modules directory +# of the currently running kernel. Check and copy modules if +# necessary. +# This is a bug that has only been found to occur on RHEL 7.2. +if [[ ! -d /lib/modules/$(uname -r)/extra/openvswitch && \ + ! -d /lib/modules/$(uname -r)/weak-updates/openvswitch ]]; then + found="false" + for i in `ls -t /lib/modules` + do + if [ -d /lib/modules/$i/extra/openvswitch ]; then + mkdir -p /lib/modules/$(uname -r)/extra + cp -r --preserve "/lib/modules/$i/extra/openvswitch" \ + /lib/modules/$(uname -r)/extra + found="true" + break + fi + done + if [ "$found" != "true" ]; then + echo "Error in openvswitch kernel modules installation" + else + /usr/sbin/depmod -a + fi +fi + %post selinux-policy /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :