Skip to content

Commit 0dfc1f4

Browse files
Zhihao ChengMike Snitzer
authored andcommitted
dm bufio: Fix missing decrement of no_sleep_enabled if dm_bufio_client_create failed
The 'no_sleep_enabled' should be decreased in error handling path in dm_bufio_client_create() when the DM_BUFIO_CLIENT_NO_SLEEP flag is set, otherwise static_branch_unlikely() will always return true even if no dm_bufio_client instances have DM_BUFIO_CLIENT_NO_SLEEP flag set. Cc: [email protected] Fixes: 3c1c875 ("dm bufio: conditionally enable branching for DM_BUFIO_CLIENT_NO_SLEEP") Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 4fe1ec9 commit 0dfc1f4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/dm-bufio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,8 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
18581858
dm_io_client_destroy(c->dm_io);
18591859
bad_dm_io:
18601860
mutex_destroy(&c->lock);
1861+
if (c->no_sleep)
1862+
static_branch_dec(&no_sleep_enabled);
18611863
kfree(c);
18621864
bad_client:
18631865
return ERR_PTR(r);

0 commit comments

Comments
 (0)