From patchwork Sun Apr 1 03:21:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 149899 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 1DB8AB6F9F for ; Sun, 1 Apr 2012 13:22:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280Ab2DADWD (ORCPT ); Sat, 31 Mar 2012 23:22:03 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:64977 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754219Ab2DADWC (ORCPT ); Sat, 31 Mar 2012 23:22:02 -0400 Received: from www262.sakura.ne.jp (ksav21.sakura.ne.jp [210.224.165.143]) by www262.sakura.ne.jp (8.14.3/8.14.3) with ESMTP id q313LxbZ045812; Sun, 1 Apr 2012 12:21:59 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) X-Nat-Received: from [202.181.97.72]:50948 [ident-empty] by smtp-proxy.isp with TPROXY id 1333250519.14924 Received: from CLAMP (KD175108057186.ppp-bb.dion.ne.jp [175.108.57.186]) by www262.sakura.ne.jp (8.14.3/8.14.3) with ESMTP id q313LwfP045809; Sun, 1 Apr 2012 12:21:59 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) To: levinsasha928@gmail.com, oleg@redhat.com Cc: eric.dumazet@gmail.com, davem@davemloft.net, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davej@redhat.com Subject: Re: ipv6: tunnel: hang when destroying ipv6 tunnel From: Tetsuo Handa References: <1333227549.2325.4051.camel@edumazet-glaptop> <20120331213423.GA21219@redhat.com> In-Reply-To: Message-Id: <201204011221.GAG51016.JQFSFFOtLOMVHO@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Sun, 1 Apr 2012 12:21:58 +0900 Mime-Version: 1.0 X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.44/RELEASE, bases: 01042012 #7541886, status: clean Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Sasha Levin wrote: > While it seems that 9p is the culprit, I have to point out that this > bug is easily reproducible, and it happens each time due to a > call_usermode_helper() call. Other than that 9p behaves perfectly and > I'd assume that I'd be seeing other things break besides > call_usermode_helper() related ones. I think one of below two patches can catch the bug if this is a usermodehelper related bug. Please try. ----- Patch 1 ----- --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/kmod.c b/kernel/kmod.c index 01394b6..3e63319 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -571,7 +571,7 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) * flag, for khelper thread is already waiting for the thread at * wait_for_completion() in do_fork(). */ - if (wait != UMH_NO_WAIT && current == kmod_thread_locker) { + if (WARN_ON(wait != UMH_NO_WAIT && current == kmod_thread_locker)) { retval = -EBUSY; goto out; } ----- Patch 2 ----- diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 9efeae6..1350670 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -48,10 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; struct cred; struct file; -#define UMH_NO_WAIT 0 /* don't wait at all */ -#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ -#define UMH_WAIT_PROC 2 /* wait for the process to complete */ -#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ +#define UMH_NO_WAIT 0x10 /* don't wait at all */ +#define UMH_WAIT_EXEC 0x11 /* wait for the exec, but not the process */ +#define UMH_WAIT_PROC 0x12 /* wait for the process to complete */ +#define UMH_KILLABLE 0x04 /* wait for EXEC/PROC killable */ struct subprocess_info { struct work_struct work; diff --git a/kernel/kmod.c b/kernel/kmod.c index 957a7aa..ecfd3d5 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -483,6 +483,18 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) DECLARE_COMPLETION_ONSTACK(done); int retval = 0; + if (unlikely(wait == -1 || wait == 0 || wait == 1)) { + WARN(1, "Requesting for usermode helper with hardcoded wait " + "flag. Change to use UMH_* symbols and recompile, or " + "this request will fail on Linux 3.4.\n"); + if (wait == -1) + wait = UMH_NO_WAIT; + else if (wait == 0) + wait = UMH_WAIT_EXEC; + else + wait = UMH_WAIT_PROC; + } + helper_lock(); if (sub_info->path[0] == '\0') goto out;