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
Kconfig -rw-r--r-- 898 bytes
Makefile -rw-r--r-- 416 bytes
afs.h -rw-r--r-- 6.0 KB
afs_cm.h -rw-r--r-- 1.2 KB
afs_fs.h -rw-r--r-- 2.3 KB
afs_vl.h -rw-r--r-- 3.6 KB
cache.c -rw-r--r-- 10.8 KB
callback.c -rw-r--r-- 11.3 KB
cell.c -rw-r--r-- 10.3 KB
cmservice.c -rw-r--r-- 13.2 KB
dir.c -rw-r--r-- 27.1 KB
file.c -rw-r--r-- 8.6 KB
flock.c -rw-r--r-- 15.8 KB
fsclient.c -rw-r--r-- 44.1 KB
inode.c -rw-r--r-- 12.2 KB
internal.h -rw-r--r-- 31.1 KB
main.c -rw-r--r-- 4.4 KB
misc.c -rw-r--r-- 2.3 KB
mntpt.c -rw-r--r-- 6.7 KB
netdevices.c -rw-r--r-- 1.5 KB
proc.c -rw-r--r-- 17.0 KB
rxrpc.c -rw-r--r-- 20.2 KB
security.c -rw-r--r-- 8.9 KB
server.c -rw-r--r-- 7.7 KB
super.c -rw-r--r-- 12.4 KB
vlclient.c -rw-r--r-- 5.4 KB
vlocation.c -rw-r--r-- 17.5 KB
vnode.c -rw-r--r-- 24.1 KB
volume.c -rw-r--r-- 9.9 KB
write.c -rw-r--r-- 18.1 KB

back to top