-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'dm-3.14-changes' of git://git.kernel.org/pub/scm/linux/ker…
…nel/git/device-mapper/linux-dm Pull device-mapper changes from Mike Snitzer: "A lot of attention was paid to improving the thin-provisioning target's handling of metadata operation failures and running out of space. A new 'error_if_no_space' feature was added to allow users to error IOs rather than queue them when either the data or metadata space is exhausted. Additional fixes/features include: - a few fixes to properly support thin metadata device resizing - a solution for reliably waiting for a DM device's embedded kobject to be released before destroying the device - old dm-snapshot is updated to use the dm-bufio interface to take advantage of readahead capabilities that improve snapshot activation - new dm-cache target tunables to control how quickly data is promoted to the cache (fast) device - improved write efficiency of cluster mirror target by combining userspace flush and mark requests" * tag 'dm-3.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: (35 commits) dm log userspace: allow mark requests to piggyback on flush requests dm space map metadata: fix bug in resizing of thin metadata dm cache: add policy name to status output dm thin: fix pool feature parsing dm sysfs: fix a module unload race dm snapshot: use dm-bufio prefetch dm snapshot: use dm-bufio dm snapshot: prepare for switch to using dm-bufio dm snapshot: use GFP_KERNEL when initializing exceptions dm cache: add block sizes and total cache blocks to status output dm btree: add dm_btree_find_lowest_key dm space map metadata: fix extending the space map dm space map common: make sure new space is used during extend dm: wait until embedded kobject is released before destroying a device dm: remove pointless kobject comparison in dm_get_from_kobject dm snapshot: call destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() dm cache policy mq: introduce three promotion threshold tunables dm cache policy mq: use list_del_init instead of list_del + INIT_LIST_HEAD dm thin: fix set_pool_mode exposed pool operation races dm thin: eliminate the no_free_space flag ...
- Loading branch information
Showing
29 changed files
with
767 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "dm.h" | ||
|
||
/* | ||
* The kobject release method must not be placed in the module itself, | ||
* otherwise we are subject to module unload races. | ||
* | ||
* The release method is called when the last reference to the kobject is | ||
* dropped. It may be called by any other kernel code that drops the last | ||
* reference. | ||
* | ||
* The release method suffers from module unload race. We may prevent the | ||
* module from being unloaded at the start of the release method (using | ||
* increased module reference count or synchronizing against the release | ||
* method), however there is no way to prevent the module from being | ||
* unloaded at the end of the release method. | ||
* | ||
* If this code were placed in the dm module, the following race may | ||
* happen: | ||
* 1. Some other process takes a reference to dm kobject | ||
* 2. The user issues ioctl function to unload the dm device | ||
* 3. dm_sysfs_exit calls kobject_put, however the object is not released | ||
* because of the other reference taken at step 1 | ||
* 4. dm_sysfs_exit waits on the completion | ||
* 5. The other process that took the reference in step 1 drops it, | ||
* dm_kobject_release is called from this process | ||
* 6. dm_kobject_release calls complete() | ||
* 7. a reschedule happens before dm_kobject_release returns | ||
* 8. dm_sysfs_exit continues, the dm device is unloaded, module reference | ||
* count is decremented | ||
* 9. The user unloads the dm module | ||
* 10. The other process that was rescheduled in step 7 continues to run, | ||
* it is now executing code in unloaded module, so it crashes | ||
* | ||
* Note that if the process that takes the foreign reference to dm kobject | ||
* has a low priority and the system is sufficiently loaded with | ||
* higher-priority processes that prevent the low-priority process from | ||
* being scheduled long enough, this bug may really happen. | ||
* | ||
* In order to fix this module unload race, we place the release method | ||
* into a helper code that is compiled directly into the kernel. | ||
*/ | ||
|
||
void dm_kobject_release(struct kobject *kobj) | ||
{ | ||
complete(dm_get_completion_from_kobject(kobj)); | ||
} | ||
|
||
EXPORT_SYMBOL(dm_kobject_release); |
Oops, something went wrong.