From patchwork Thu May 14 16:06:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 472388 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0CE14140283 for ; Fri, 15 May 2015 02:07:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=jtP02QGB; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422740AbbENQH3 (ORCPT ); Thu, 14 May 2015 12:07:29 -0400 Received: from mail-qk0-f181.google.com ([209.85.220.181]:35756 "EHLO mail-qk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422680AbbENQGu (ORCPT ); Thu, 14 May 2015 12:06:50 -0400 Received: by qkgy4 with SMTP id y4so52408385qkg.2; Thu, 14 May 2015 09:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kxXHl7oeUqyS1M7cSsDL8+DZCfe11drsObauEV7GVNg=; b=jtP02QGBNF+LO/Rs35pHKRofnQWrz/vnS1B70IhXgdW40CgBrhXRZBEQQhqmYDHweV ejbJYyL/YJ+zybTpdEVptLMA/7tWSm06Wp5JROoCsO4B8cQ+L3L6Lyhqx3d61lShn9Uy 07v+4MIm5bJG0wyJ3pBlLh1idihG/xsY0hQIpt2XVzvh5fCJkoyDYWZ3ytzch084Hb37 yTpIG8eiEV/UZv3AmoPGPQMIQJMJgOO2wQyIORjcjFIy6DDdv1rv0UdDmNyXlxmPfy2C oEbPfsmRJss4hyqVIz43cVEF8ajEt9BU8JW94zrGjucdhLU1ul5AZIZxNz96ii+VPseQ /o7A== X-Received: by 10.229.198.71 with SMTP id en7mr6737703qcb.14.1431619608981; Thu, 14 May 2015 09:06:48 -0700 (PDT) Received: from htj.duckdns.org.lan (207-38-238-8.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com. [207.38.238.8]) by mx.google.com with ESMTPSA id y195sm18099132qky.24.2015.05.14.09.06.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2015 09:06:48 -0700 (PDT) From: Tejun Heo To: akpm@linux-foundation.org Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Tejun Heo Subject: [PATCH 6/7] netconsole: make all dynamic netconsoles share a mutex Date: Thu, 14 May 2015 12:06:25 -0400 Message-Id: <1431619586-29187-7-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1431619586-29187-1-git-send-email-tj@kernel.org> References: <1431619586-29187-1-git-send-email-tj@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, each dynamic netconsole_target uses its own separate mutex to synchronize the configuration operations. This patch replaces the per-netconsole_target mutexes with a single mutex - dynamic_netconsole_mutex. The reduced granularity doesn't hurt anything, the code is minutely simpler and this'd allow adding operations which should be synchronized across all dynamic netconsoles. Signed-off-by: Tejun Heo Cc: David Miller --- drivers/net/netconsole.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 8dd1e55..9b0c81e 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -105,13 +105,13 @@ struct netconsole_target { struct config_item item; #endif bool enabled; - struct mutex mutex; struct netpoll np; }; #ifdef CONFIG_NETCONSOLE_DYNAMIC static struct configfs_subsystem netconsole_subsys; +static DEFINE_MUTEX(dynamic_netconsole_mutex); static int __init dynamic_netconsole_init(void) { @@ -185,7 +185,6 @@ static struct netconsole_target *alloc_param_target(char *target_config) strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); nt->np.local_port = 6665; nt->np.remote_port = 6666; - mutex_init(&nt->mutex); eth_broadcast_addr(nt->np.remote_mac); /* Parse parameters and setup netpoll */ @@ -562,10 +561,10 @@ static ssize_t netconsole_target_attr_store(struct config_item *item, struct netconsole_target_attr *na = container_of(attr, struct netconsole_target_attr, attr); - mutex_lock(&nt->mutex); + mutex_lock(&dynamic_netconsole_mutex); if (na->store) ret = na->store(nt, buf, count); - mutex_unlock(&nt->mutex); + mutex_unlock(&dynamic_netconsole_mutex); return ret; } @@ -604,7 +603,6 @@ static struct config_item *make_netconsole_target(struct config_group *group, strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ); nt->np.local_port = 6665; nt->np.remote_port = 6666; - mutex_init(&nt->mutex); eth_broadcast_addr(nt->np.remote_mac); /* Initialize the config_item member */