From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964879AbZJJPjp (ORCPT ); Sat, 10 Oct 2009 11:39:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933074AbZJJPjo (ORCPT ); Sat, 10 Oct 2009 11:39:44 -0400 Received: from www.tglx.de ([62.245.132.106]:55681 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934412AbZJJPjb (ORCPT ); Sat, 10 Oct 2009 11:39:31 -0400 Message-Id: <20091010153349.154442560@linutronix.de> User-Agent: quilt/0.47-1 Date: Sat, 10 Oct 2009 15:35:33 -0000 From: Thomas Gleixner To: LKML Cc: Andrew Morton , Ingo Molnar , Peter Zijlstra , Frederic Weisbecker , Vincent Sanders , John Kacur , Jonathan Corbet , Christoph Hellwig , Herbert Xu , "David S. Miller" Subject: [patch 03/28] net: Remove BKL from tun References: <20091010153314.827301943@linutronix.de> Content-Disposition: inline; filename=drivers-net-tun-remove-bkl.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The lock_kernel/unlock_kernel() in cycle_kernel_lock() which is called in tun_chr_open() is not serializing against anything and safe to remove. tun_chr_fasync() is serialized by get/put_tun() and fasync_helper() has no dependency on BKL. The modification of tun->flags is racy with and without the BKL so removing it does not make it worse. Signed-off-by: Thomas Gleixner Cc: Herbert Xu Cc: David S. Miller --- drivers/net/tun.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) Index: linux-2.6-tip/drivers/net/tun.c =================================================================== --- linux-2.6-tip.orig/drivers/net/tun.c +++ linux-2.6-tip/drivers/net/tun.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -1285,7 +1284,6 @@ static int tun_chr_fasync(int fd, struct DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); - lock_kernel(); if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) goto out; @@ -1298,7 +1296,6 @@ static int tun_chr_fasync(int fd, struct tun->flags &= ~TUN_FASYNC; ret = 0; out: - unlock_kernel(); tun_put(tun); return ret; } @@ -1306,7 +1303,7 @@ out: static int tun_chr_open(struct inode *inode, struct file * file) { struct tun_file *tfile; - cycle_kernel_lock(); + DBG1(KERN_INFO "tunX: tun_chr_open\n"); tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);