[PATCH] null_blk: Add __must_hold macro for null_flush_cache_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It seems that call null_flush_cache_page() must hold nullb->lock and it
returns with nullb->lock held. However, this is not clearly described, and
the caller may forget to hold the lock. Therefore, add __must_hold() macro
to the function entry to show that the lock is held on function entry and
exit, which allows sparse to do lock checking.

Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
---
 drivers/block/null_blk/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index ed33cf7192d2..adca31e55deb 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1013,7 +1013,7 @@ static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page)
 	return 0;
 }
 
-static int null_make_cache_space(struct nullb *nullb, unsigned long n)
+static int null_make_cache_space(struct nullb *nullb, unsigned long n) __must_hold(&nullb->lock)
 {
 	int i, err, nr_pages;
 	struct nullb_page *c_pages[FREE_BATCH];
-- 
2.34.1





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux