]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm: replace -EEXIST with -EBUSY
authorDaniel Gomez <da.gomez@samsung.com>
Sat, 20 Dec 2025 03:49:37 +0000 (04:49 +0100)
committerMikulas Patocka <mpatocka@redhat.com>
Fri, 2 Jan 2026 14:13:56 +0000 (15:13 +0100)
The -EEXIST error code is reserved by the module loading infrastructure
to indicate that a module is already loaded. When a module's init
function returns -EEXIST, userspace tools like kmod interpret this as
"module already loaded" and treat the operation as successful, returning
0 to the user even though the module initialization actually failed.

This follows the precedent set by commit 54416fd76770 ("netfilter:
conntrack: helper: Replace -EEXIST by -EBUSY") which fixed the same
issue in nf_conntrack_helper_register().

Affected modules:
  * dm_cache dm_clone dm_integrity dm_mirror dm_multipath dm_pcache
  * dm_vdo dm-ps-round-robin dm_historical_service_time dm_io_affinity
  * dm_queue_length dm_service_time dm_snapshot

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-exception-store.c
drivers/md/dm-log.c
drivers/md/dm-path-selector.c
drivers/md/dm-target.c

index c3799757bf4a0cc7e1821724e22481c8de22f5ab..88f119a0a2ae0d1397faa9228d1d77f23cc36ba6 100644 (file)
@@ -116,7 +116,7 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type)
        if (!__find_exception_store_type(type->name))
                list_add(&type->list, &_exception_store_types);
        else
-               r = -EEXIST;
+               r = -EBUSY;
        spin_unlock(&_lock);
 
        return r;
index 9d85d045f9d9d5ec8c25c39989e15391e52f6606..bced5a783ee3395b144c2bb92556a76e86b9c37e 100644 (file)
@@ -121,7 +121,7 @@ int dm_dirty_log_type_register(struct dm_dirty_log_type *type)
        if (!__find_dirty_log_type(type->name))
                list_add(&type->list, &_log_types);
        else
-               r = -EEXIST;
+               r = -EBUSY;
        spin_unlock(&_lock);
 
        return r;
index d0b883fabfeb6f3011a7876183a1ce529a879adb..2b0ac200f1c02c95cb521b44814de6ac0c53b1a2 100644 (file)
@@ -107,7 +107,7 @@ int dm_register_path_selector(struct path_selector_type *pst)
 
        if (__find_path_selector_type(pst->name)) {
                kfree(psi);
-               r = -EEXIST;
+               r = -EBUSY;
        } else
                list_add(&psi->list, &_path_selectors);
 
index 8fede41adec0044e2c20b09b461dc6f422ff207c..1fd41289de3674bdf0698eaee4794db25b66e22b 100644 (file)
@@ -88,7 +88,7 @@ int dm_register_target(struct target_type *tt)
        if (__find_target_type(tt->name)) {
                DMERR("%s: '%s' target already registered",
                      __func__, tt->name);
-               rv = -EEXIST;
+               rv = -EBUSY;
        } else {
                list_add(&tt->list, &_targets);
        }