• Bart Van Assche's avatar
    blk-mq: Fix preempt count imbalance · abc25a69
    Bart Van Assche authored
    Avoid that the following kernel bug gets triggered:
    
    BUG: sleeping function called from invalid context at ./include/linux/buffer_head.h:349
    in_atomic(): 1, irqs_disabled(): 0, pid: 8019, name: find
    CPU: 10 PID: 8019 Comm: find Tainted: G        W I     4.11.0-rc4-dbg+ #2
    Call Trace:
     dump_stack+0x68/0x93
     ___might_sleep+0x16e/0x230
     __might_sleep+0x4a/0x80
     __ext4_get_inode_loc+0x1e0/0x4e0
     ext4_iget+0x70/0xbc0
     ext4_iget_normal+0x2f/0x40
     ext4_lookup+0xb6/0x1f0
     lookup_slow+0x104/0x1e0
     walk_component+0x19a/0x330
     path_lookupat+0x4b/0x100
     filename_lookup+0x9a/0x110
     user_path_at_empty+0x36/0x40
     vfs_statx+0x67/0xc0
     SYSC_newfstatat+0x20/0x40
     SyS_newfstatat+0xe/0x10
     entry_SYSCALL_64_fastpath+0x18/0xad
    
    This happens since the big if/else in blk_mq_make_request() doesn't
    have final else section that also drops the ctx. Add that.
    
    Fixes: b00c53e8 ("blk-mq: fix schedule-while-atomic with scheduler attached")
    Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
    Cc: Omar Sandoval <osandov@fb.com>
    
    Added a bit more to the commit log.
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    abc25a69
blk-mq.c 69.9 KB