From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754881AbcBPKb6 (ORCPT ); Tue, 16 Feb 2016 05:31:58 -0500 Received: from mail-by2on0143.outbound.protection.outlook.com ([207.46.100.143]:2112 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754795AbcBPKb4 convert rfc822-to-8bit (ORCPT ); Tue, 16 Feb 2016 05:31:56 -0500 From: Xianpeng Zhao To: "linux-kernel@vger.kernel.org" Subject: [linux-kernel] dead loop for rtnl_trylock Thread-Topic: [linux-kernel] dead loop for rtnl_trylock Thread-Index: AdFopSLfdDbq7DsvQYeG8sKdBAx+Ew== Date: Tue, 16 Feb 2016 10:31:53 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=aerohive.com; x-originating-ip: [101.71.241.46] x-microsoft-exchange-diagnostics: 1;CY1PR11MB0491;5:4EjOHo7BMKYJJJoIhiv2UPNcoHr1CPmOV80eyJMPSpDz6LdmCLiLhKy5/10uZxABHc/iLnq3Maecobn0UnoTbFKvxjkUfpkR42AfQU6LCds09KrLfPaikgMlGRB8X+xQIlWS7bk8sVyMDvw0L2JB8Q==;24:2y72k8q9WK0XosPJ2ymVhj+RTdaoZQ3waA4/PjLg/Gt4xuXj5U5sCIdDP4NGrjjcEq9Bac9vEactfLM6F+KYlTAcuABfzE3/foGbxgyP0YI= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR11MB0491; x-ms-office365-filtering-correlation-id: 38f9b1c2-72f9-45f2-4d6e-08d336bc6383 x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:CY1PR11MB0491;BCL:0;PCL:0;RULEID:;SRVR:CY1PR11MB0491; x-forefront-prvs: 0854128AF0 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(450100001)(5002640100001)(2351001)(33656002)(6116002)(3846002)(99286002)(5003600100002)(102836003)(66066001)(1220700001)(110136002)(77096005)(229853001)(1096002)(2501003)(107886002)(5001960100002)(86362001)(87936001)(3660700001)(76576001)(3280700002)(586003)(5004730100002)(11100500001)(5008740100001)(74316001)(50986999)(2906002)(189998001)(2900100001)(122556002)(10400500002)(40100003)(92566002)(54356999);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR11MB0491;H:CY1PR11MB0491.namprd11.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: aerohive.com X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Feb 2016 10:31:53.9735 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 2340d47a-362d-4a44-8868-de975641bd68 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR11MB0491 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Group,          I have find a problem in my system, I found there have a chance that cause the system enter dead loop when try to get the rtnl lock in the sysctl function in net/ipv6/addrconf.c          The situation should like this, there are 2 processes may need get the rtnl lock, we call them process A and process B, A have high priority than B. B need get the rtnl lock to do something, when B schedule out without release the lock; At this time, the A start to run "echo 1 > /proc/sys/net/ipv6/conf//disable_ipv6", the echo process will run to this code:     if (!rtnl_trylock())         return restart_syscall(); Because the rtnl lock was hold by process B, so here the try will be failure, and run the restart_syscall to let the sys_write do again, even try many times, because the B have very lower priority, the lock was hard to be released, so the echo process created by A will enter a loop of restart system call. In my case it is the wireless_nlevent_process in process kworker taken the rtnl lock, and another higher priority process need use echo to disable IPv6 met this problem. I am not very sure, but I think it is better to let the process A sleep a while instead of try it again and again without any delay. Expects, what's your opinions? @@ -5304,8 +5308,10 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf) struct net *net; int old; - if (!rtnl_trylock()) + if (!rtnl_trylock()){ + schedule_timeout_uninterruptible(HZ/4); return restart_syscall(); + } net = (struct net *)table->extra2; old = *p;