Enable lock context analysis in drivers/block/#947
Conversation
|
Upstream branch: 8b87d2b |
|
Upstream branch: 8b87d2b |
d431b82 to
55a36ea
Compare
|
Upstream branch: 8b87d2b |
55a36ea to
d772389
Compare
|
Upstream branch: 8b87d2b |
d772389 to
d1a7988
Compare
|
Upstream branch: 8b87d2b |
d1a7988 to
28a8671
Compare
108c4f0 to
80c450e
Compare
|
Upstream branch: 8282f98 |
28a8671 to
d46f60a
Compare
|
Upstream branch: 8282f98 |
d46f60a to
56d19d2
Compare
80c450e to
627050e
Compare
|
Upstream branch: 1d1de89 |
56d19d2 to
1253071
Compare
627050e to
e84ed1e
Compare
|
Upstream branch: 5c7804e |
1253071 to
8181c0d
Compare
e84ed1e to
af3fc2b
Compare
|
Upstream branch: b9e3062 |
8181c0d to
55f441f
Compare
af3fc2b to
39de126
Compare
|
Upstream branch: 523fc0d |
55f441f to
d224906
Compare
39de126 to
f48a15a
Compare
fdcf345 to
e0cbfee
Compare
Add a missing __must_hold() annotation. Enable lock context analysis in the Makefile. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Md Haris Iqbal <haris.iqbal@linux.dev>
The "extern" keyword is superfluous when declaring a function. Remove that keyword from function definitions to improve consistency with the rest of the kernel source code. Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
There are two slightly different _get_ldev_if_state() implementations in the DRBD source code. Keep the version that is used. This does not affect C=1 / C=2 builds because lock context checking is performed by Clang instead of sparse since commit 5b63d0a ("compiler-context- analysis: Remove Sparse support"). Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
The get_ldev_if_state() macro has been introduced because sparse does not support something like __cond_acquires(). Remove this macro and rename _get_ldev_if_state() into get_ldev_if_state(). Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
The 'local' lock context represents code sections between get_ldev() and put_ldev() calls. Between these two calls the device->ldev pointer is valid. Since there are multiple functions with unpaired get_ldev() / put_ldev() calls, remove this lock context. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Call mutex_lock() instead of mutex_trylock() followed by mutex_lock().
Remove the code that depends on device->bitmap == NULL because this
can't happen. All drbd_bm_{lock,unlock}() callers guarantee that the
device->bitmap pointer is valid.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Move the resources_mutex declaration in front of the functions that acquire and release this mutex. Move the drbd_wait_misc() declaration past the struct drbd_device definition. This patch prepares for adding lock context annotations. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Prepare for adding lock context annotations. Without this change, an __assume_ctx_lock() statement would have to be added. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Move the code between the 'put_result' and 'out' labels into a new function. Prepare for making the following code unconditional: if (resource) mutex_unlock(&resource->conf_update); Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Only jump to the 'out' label if resource is not NULL such that the mutex_unlock() call past the 'out' label can be made unconditional. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Move all code except a mutex_lock() and a mutex_unlock() call from drbd_req_state() into the new function __drbd_req_state(). This patch prepares for adding a second __drbd_req_state() caller. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Prepare for enabling lock context analysis. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Annotate the bitmap locking functions. Introduce a new token context lock because the struct drbd_device definition is not visible from the drbd_int.h header file. Annotate the declarations of bitmap locking functions with only the token context lock. Annotate the definitions of the bitmap locking functions with both the token context lock and the actual mutex. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Clang performs more strict checking of lock context annotations than sparse. This patch makes the DRBD lock context annotations compatible with Clang and enables lock context analysis in the Makefile. Cc: Christoph Böhmwalder <christoph.boehmwalder@linbit.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Prepare for adding a second call of __loop_change_fd(). Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Prepare for adding a second __loop_configure() call. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Keep the behavior in loop_global_lock_killable() for the global == true case. Expand loop_global_lock_killable(lo, false) calls into a mutex_lock_killable() and a mutex_unlock() call. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Add lock context annotations that are compatible with Clang. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Let the compiler verify lock and unlock calls. Enable lock context analysis in the Makefile. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Add the missing __must_hold() annotations. Enable lock context analysis in the Makefile. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Add __must_hold() annotations where these are missing. Annotate two functions that use conditional locking with __context_unsafe(). Enable lock context analysis in the Makefile. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Add lock context annotations and enable lock context analysis. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Add the lock context annotations that are required by Clang. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Let Clang verify lock and unlock calls. Enable lock context analysis in the Makefile. Acked-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
|
Upstream branch: 54740e4 |
Add the lock context annotations that are required by Clang. Enable lock context analysis in the Makefile. Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Let Clang verify lock and unlock calls. Enable lock context analysis in the Makefile. Acked-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Now that all locking functions in block drivers have been annotated, enable lock context analysis for all block drivers at the top level of drivers/block/. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4c79a4a to
8989b71
Compare
Pull request for series with
subject: Enable lock context analysis in drivers/block/
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1108850