From: Alexey Obitotskiy Date: Thu, 23 Jun 2016 10:11:01 +0000 (+0200) Subject: Fix kernel module refcount handling X-Git-Tag: v4.8-rc1~113^2^2~3 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4cb9da7d9c631514effa5e806f9de7c7c746c3a8;p=karo-tx-linux.git Fix kernel module refcount handling md loads raidX modules and increments module refcount each time level has changed but does not decrement it. You are unable to unload raid0 module after reshape because raid0 reshape changes level to raid4 and back to raid0. Signed-off-by: Aleksey Obitotskiy Signed-off-by: Shaohua Li --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 4b8a264e9777..29297e97cdea 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3579,6 +3579,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) mddev->to_remove = &md_redundancy_group; } + module_put(oldpers->owner); + rdev_for_each(rdev, mddev) { if (rdev->raid_disk < 0) continue;