• Ming Lei's avatar
    block: replace trylock with mutex_lock in blkdev_reread_part() · b04a5636
    Ming Lei authored
    The only possible problem of using mutex_lock() instead of trylock
    is about deadlock.
    
    If there aren't any locks held before calling blkdev_reread_part(),
    deadlock can't be caused by this conversion.
    
    If there are locks held before calling blkdev_reread_part(),
    and if these locks arn't required in open, close handler and I/O
    path, deadlock shouldn't be caused too.
    
    Both user space's ioctl(BLKRRPART) and md_setup_drive() from
    init/do_mounts_md.c belongs to the 1st case, so the conversion is safe
    for the two cases.
    
    For loop, the previous patches in this pathset has fixed the ABBA lock
    dependency, so the conversion is OK.
    
    For nbd, tx_lock is held when calling the function:
    
    	- both open and release won't hold the lock
    	- when blkdev_reread_part() is run, I/O thread has been stopped
    	already, so tx_lock won't be acquired in I/O path at that time.
    	- so the conversion won't cause deadlock for nbd
    
    For dasd, both dasd_open(), dasd_release() and request function don't
    acquire any mutex/semphone, so the conversion should be safe.
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Tested-by: default avatarJarod Wilson <jarod@redhat.com>
    Acked-by: default avatarJarod Wilson <jarod@redhat.com>
    Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    b04a5636
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt/kvm Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...