From patchwork Sun Jan 15 12:59:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 136183 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 47D52B6F6F for ; Mon, 16 Jan 2012 00:00:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752436Ab2AOM7y (ORCPT ); Sun, 15 Jan 2012 07:59:54 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:41706 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152Ab2AOM7w (ORCPT ); Sun, 15 Jan 2012 07:59:52 -0500 Received: by eekd4 with SMTP id d4so1586845eek.19 for ; Sun, 15 Jan 2012 04:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:content-transfer-encoding:mime-version; bh=QyUm6Om2TGJHdJ5Hhm5NB4DEiP5oCbcnCC8Sb+y8zS0=; b=PVXTSISHpnD2gqCR4fkIgPjZjDSPpUMEogMjUNWFAksKat5bo38VrMT9p2itCugDEd wrv4dpmfEje8Oo1ftMbgRhhsvN4n/Kkxibr5fgXhtNZ2DamnS1Hs5wJVW88TmKSRRRqY YitKILAKhU9+nuaJWF0uqMYNonJjNA2Lk4k4A= Received: by 10.213.105.144 with SMTP id t16mr1646584ebo.95.1326632390902; Sun, 15 Jan 2012 04:59:50 -0800 (PST) Received: from [10.0.0.7] (bzq-218-193-136.red.bezeqint.net. [81.218.193.136]) by mx.google.com with ESMTPS id s16sm57961130eef.2.2012.01.15.04.59.47 (version=SSLv3 cipher=OTHER); Sun, 15 Jan 2012 04:59:49 -0800 (PST) Message-ID: <1326632384.11711.3.camel@lappy> Subject: Re: Hung task when calling clone() due to netfilter/slab From: Sasha Levin To: Eric Dumazet Cc: Dave Jones , davem , Pekka Enberg , Christoph Lameter , Matt Mackall , kaber@trash.net, pablo@netfilter.org, linux-kernel , linux-mm , netfilter-devel@vger.kernel.org, netdev Date: Sun, 15 Jan 2012 14:59:44 +0200 In-Reply-To: <1326561043.5287.24.camel@edumazet-laptop> References: <1326558605.19951.7.camel@lappy> <1326561043.5287.24.camel@edumazet-laptop> X-Mailer: Evolution 3.2.2 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 2012-01-14 at 18:10 +0100, Eric Dumazet wrote: > Apparently SLUB calls sysfs_slab_add() from kmem_cache_create() while > still holding slub_lock. > > So if the task launched needs to "cat /proc/slabinfo" or anything > needing slub_lock, its a deadlock. I've made the following patch to test it, It doesn't look like it's the correct solution, but it verifies that the problem is there (it works well with the patch). --------------- From cc4874b491b8e5d9d1ea5bf2032413efdbddced8 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 15 Jan 2012 14:55:03 +0200 Subject: [PATCH] slab: Fix hang when creating sysfs entries This patch fixes the hang which happens when we create a sysfs entry and call back to userspace. If the usermode helper tries to do anything which involves slub_lock we will hang since slub_lock is already held. Signed-off-by: Sasha Levin --- mm/slub.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 4907563..6948327 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5283,7 +5283,9 @@ static int sysfs_slab_add(struct kmem_cache *s) kobject_put(&s->kobj); return err; } + up_write(&slub_lock); kobject_uevent(&s->kobj, KOBJ_ADD); + down_write(&slub_lock); if (!unmergeable) { /* Setup first alias */ sysfs_slab_alias(s, s->name);