]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
loop: Move special partition reread handling in loop_clr_fd()
authorJan Kara <jack@suse.cz>
Thu, 8 Nov 2018 13:01:12 +0000 (14:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 20:10:00 +0000 (21:10 +0100)
commite04b3348a6b696031048fd177b0cfb53f98bfd92
tree2f94f094527eec090e209533c5a5e71201d6647f
parentaf2dfddd003209adf70a62d9308316faff398b51
loop: Move special partition reread handling in loop_clr_fd()

commit d57f3374ba4817f7c8d26fae8a13d20ac8d31b92 upstream.

The call of __blkdev_reread_part() from loop_reread_partition() happens
only when we need to invalidate partitions from loop_release(). Thus
move a detection for this into loop_clr_fd() and simplify
loop_reread_partition().

This makes loop_reread_partition() safe to use without loop_ctl_mutex
because we use only lo->lo_number and lo->lo_file_name in case of error
for reporting purposes (thus possibly reporting outdate information is
not a big deal) and we are safe from 'lo' going away under us by
elevated lo->lo_refcnt.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/loop.c