Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760318AbYAQWkU (ORCPT ); Thu, 17 Jan 2008 17:40:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759812AbYAQWgk (ORCPT ); Thu, 17 Jan 2008 17:36:40 -0500 Received: from agminet01.oracle.com ([141.146.126.228]:36240 "EHLO agminet01.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758194AbYAQWgg (ORCPT ); Thu, 17 Jan 2008 17:36:36 -0500 From: Mark Fasheh To: linux-kernel@vger.kernel.org Cc: ocfs2-devel@oss.oracle.com, Joonwoo Park Subject: [PATCH 30/30] configfs: file.c fix possible recursive locking Date: Thu, 17 Jan 2008 14:35:56 -0800 Message-Id: <1200609356-17788-31-git-send-email-mark.fasheh@oracle.com> X-Mailer: git-send-email 1.5.3.4 In-Reply-To: <1200609356-17788-1-git-send-email-mark.fasheh@oracle.com> References: <1200609356-17788-1-git-send-email-mark.fasheh@oracle.com> X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2493 Lines: 66 From: Joonwoo Park configfs_register_subsystem() with default_groups triggers recursive locking. it seems that mutex_lock_nested is needed. ============================================= [ INFO: possible recursive locking detected ] 2.6.24-rc6 #145 --------------------------------------------- swapper/1 is trying to acquire lock: (&sb->s_type->i_mutex_key#3){--..}, at: [] configfs_add_file+0x2e/0x70 but task is already holding lock: (&sb->s_type->i_mutex_key#3){--..}, at: [] configfs_register_subsystem+0x55/0x130 other info that might help us debug this: 1 lock held by swapper/1: #0: (&sb->s_type->i_mutex_key#3){--..}, at: [] configfs_register_subsystem+0x55/0x130 stack backtrace: Pid: 1, comm: swapper Not tainted 2.6.24-rc6 #145 [] show_trace_log_lvl+0x1a/0x30 [] show_trace+0x12/0x20 [] dump_stack+0x6e/0x80 [] __lock_acquire+0xe62/0x1120 [] lock_acquire+0x82/0xa0 [] mutex_lock_nested+0x98/0x2e0 [] configfs_add_file+0x2e/0x70 [] configfs_create_file+0x2c/0x40 [] configfs_attach_item+0x139/0x220 [] configfs_attach_group+0x14/0x140 [] configfs_attach_group+0xc9/0x140 [] configfs_register_subsystem+0xc6/0x130 [] init_netconsole+0x2b6/0x300 [] kernel_init+0x142/0x320 [] kernel_thread_helper+0x7/0x14 ======================= Signed-off-by: Joonwoo Park Signed-off-by: Joel Becker Signed-off-by: Mark Fasheh --- fs/configfs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/configfs/file.c b/fs/configfs/file.c index a3658f9..397cb50 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -320,7 +320,7 @@ int configfs_add_file(struct dentry * dir, const struct configfs_attribute * att umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; int error = 0; - mutex_lock(&dir->d_inode->i_mutex); + mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type); mutex_unlock(&dir->d_inode->i_mutex); -- 1.5.3.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/