Revision ee297209bf0a25c6717b7c063e76795142d32f37 authored by Xiaotian Feng on 20 December 2012, 23:05:44 UTC, committed by Linus Torvalds on 21 December 2012, 01:40:20 UTC
Lockdep found an inconsistent lock state when rcu is processing delayed
work in softirq.  Currently, kernel is using spin_lock/spin_unlock to
protect proc_inum_ida, but proc_free_inum is called by rcu in softirq
context.

Use spin_lock_bh/spin_unlock_bh fix following lockdep warning.

  =================================
  [ INFO: inconsistent lock state ]
  3.7.0 #36 Not tainted
  ---------------------------------
  inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
  swapper/1/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
   (proc_inum_lock){+.?...}, at: proc_free_inum+0x1c/0x50
  {SOFTIRQ-ON-W} state was registered at:
     __lock_acquire+0x8ae/0xca0
     lock_acquire+0x199/0x200
     _raw_spin_lock+0x41/0x50
     proc_alloc_inum+0x4c/0xd0
     alloc_mnt_ns+0x49/0xc0
     create_mnt_ns+0x25/0x70
     mnt_init+0x161/0x1c7
     vfs_caches_init+0x107/0x11a
     start_kernel+0x348/0x38c
     x86_64_start_reservations+0x131/0x136
     x86_64_start_kernel+0x103/0x112
  irq event stamp: 2993422
  hardirqs last  enabled at (2993422):  _raw_spin_unlock_irqrestore+0x55/0x80
  hardirqs last disabled at (2993421):  _raw_spin_lock_irqsave+0x29/0x70
  softirqs last  enabled at (2993394):  _local_bh_enable+0x13/0x20
  softirqs last disabled at (2993395):  call_softirq+0x1c/0x30

  other info that might help us debug this:
   Possible unsafe locking scenario:

         CPU0
         ----
    lock(proc_inum_lock);
    <Interrupt>
      lock(proc_inum_lock);

   *** DEADLOCK ***

  no locks held by swapper/1/0.

  stack backtrace:
  Pid: 0, comm: swapper/1 Not tainted 3.7.0 #36
  Call Trace:
   <IRQ>  [<ffffffff810a40f1>] ? vprintk_emit+0x471/0x510
    print_usage_bug+0x2a5/0x2c0
    mark_lock+0x33b/0x5e0
    __lock_acquire+0x813/0xca0
    lock_acquire+0x199/0x200
    _raw_spin_lock+0x41/0x50
    proc_free_inum+0x1c/0x50
    free_pid_ns+0x1c/0x50
    put_pid_ns+0x2e/0x50
    put_pid+0x4a/0x60
    delayed_put_pid+0x12/0x20
    rcu_process_callbacks+0x462/0x790
    __do_softirq+0x1b4/0x3b0
    call_softirq+0x1c/0x30
    do_softirq+0x59/0xd0
    irq_exit+0x54/0xd0
    smp_apic_timer_interrupt+0x95/0xa3
    apic_timer_interrupt+0x72/0x80
    cpuidle_enter_tk+0x10/0x20
    cpuidle_enter_state+0x17/0x50
    cpuidle_idle_call+0x287/0x520
    cpu_idle+0xba/0x130
    start_secondary+0x2b3/0x2bc

Signed-off-by: Xiaotian Feng <dannyfeng@tencent.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c4e1849
History
File Mode Size
AUTHORS -rw-r--r-- 2.6 KB
CHANGES -rw-r--r-- 46.2 KB
Kconfig -rw-r--r-- 7.5 KB
Makefile -rw-r--r-- 625 bytes
README -rw-r--r-- 38.3 KB
TODO -rw-r--r-- 5.2 KB
asn1.c -rw-r--r-- 14.9 KB
cache.c -rw-r--r-- 7.9 KB
cifs_debug.c -rw-r--r-- 17.2 KB
cifs_debug.h -rw-r--r-- 2.7 KB
cifs_dfs_ref.c -rw-r--r-- 9.5 KB
cifs_fs_sb.h -rw-r--r-- 3.1 KB
cifs_spnego.c -rw-r--r-- 4.8 KB
cifs_spnego.h -rw-r--r-- 1.6 KB
cifs_unicode.c -rw-r--r-- 11.1 KB
cifs_unicode.h -rw-r--r-- 9.1 KB
cifs_uniupr.h -rw-r--r-- 12.6 KB
cifsacl.c -rw-r--r-- 28.7 KB
cifsacl.h -rw-r--r-- 2.9 KB
cifsencrypt.c -rw-r--r-- 22.3 KB
cifsfs.c -rw-r--r-- 32.0 KB
cifsfs.h -rw-r--r-- 5.7 KB
cifsglob.h -rw-r--r-- 48.2 KB
cifspdu.h -rw-r--r-- 80.8 KB
cifsproto.h -rw-r--r-- 22.2 KB
cifssmb.c -rw-r--r-- 188.6 KB
connect.c -rw-r--r-- 105.9 KB
dir.c -rw-r--r-- 22.0 KB
dns_resolve.c -rw-r--r-- 2.8 KB
dns_resolve.h -rw-r--r-- 1.2 KB
export.c -rw-r--r-- 2.4 KB
file.c -rw-r--r-- 93.2 KB
fscache.c -rw-r--r-- 6.4 KB
fscache.h -rw-r--r-- 4.5 KB
inode.c -rw-r--r-- 58.6 KB
ioctl.c -rw-r--r-- 2.6 KB
link.c -rw-r--r-- 14.9 KB
misc.c -rw-r--r-- 16.7 KB
netmisc.c -rw-r--r-- 39.1 KB
nterr.c -rw-r--r-- 33.5 KB
nterr.h -rw-r--r-- 30.0 KB
ntlmssp.h -rw-r--r-- 5.7 KB
readdir.c -rw-r--r-- 24.0 KB
rfc1002pdu.h -rw-r--r-- 2.8 KB
sess.c -rw-r--r-- 28.6 KB
smb1ops.c -rw-r--r-- 28.2 KB
smb2file.c -rw-r--r-- 7.7 KB
smb2glob.h -rw-r--r-- 1.7 KB
smb2inode.c -rw-r--r-- 7.1 KB
smb2maperror.c -rw-r--r-- 126.8 KB
smb2misc.c -rw-r--r-- 17.1 KB
smb2ops.c -rw-r--r-- 21.7 KB
smb2pdu.c -rw-r--r-- 59.4 KB
smb2pdu.h -rw-r--r-- 26.5 KB
smb2proto.h -rw-r--r-- 7.9 KB
smb2status.h -rw-r--r-- 125.2 KB
smb2transport.c -rw-r--r-- 8.6 KB
smbencrypt.c -rw-r--r-- 6.0 KB
smberr.h -rw-r--r-- 7.5 KB
smbfsctl.h -rw-r--r-- 4.7 KB
transport.c -rw-r--r-- 26.3 KB
xattr.c -rw-r--r-- 11.7 KB

README

back to top