Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/bitmap: fix a might_sleep() warning.

commit 8eb23b9f35aae413140d3fda766a98092c21e9b0
sched: Debug nested sleeps

causes false-positive warnings in RAID5 code.

This annotation removes them and adds a comment
explaining why there is no real problem.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>

NeilBrown d9590143 b1b02fe9

+13
+13
drivers/md/bitmap.c
··· 72 72 /* this page has not been allocated yet */ 73 73 74 74 spin_unlock_irq(&bitmap->lock); 75 + /* It is possible that this is being called inside a 76 + * prepare_to_wait/finish_wait loop from raid5c:make_request(). 77 + * In general it is not permitted to sleep in that context as it 78 + * can cause the loop to spin freely. 79 + * That doesn't apply here as we can only reach this point 80 + * once with any loop. 81 + * When this function completes, either bp[page].map or 82 + * bp[page].hijacked. In either case, this function will 83 + * abort before getting to this point again. So there is 84 + * no risk of a free-spin, and so it is safe to assert 85 + * that sleeping here is allowed. 86 + */ 87 + sched_annotate_sleep(); 75 88 mappage = kzalloc(PAGE_SIZE, GFP_NOIO); 76 89 spin_lock_irq(&bitmap->lock); 77 90