mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Check if DM create device failed in an early phase.
This happens when concurrent creation of DM devices meets in the very early state (no device node exists but creation fails). Return -ENODEV here instead of -EINVAL. (Should "fix" random verity concurrent test failure.)
This commit is contained in:
@@ -1346,12 +1346,6 @@ err:
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool dm_device_exists(struct crypt_device *cd, const char *name)
|
||||
{
|
||||
int r = dm_status_device(cd, name);
|
||||
return (r >= 0 || r == -EEXIST);
|
||||
}
|
||||
|
||||
static int _dm_create_device(struct crypt_device *cd, const char *name, const char *type,
|
||||
struct crypt_dm_active_device *dmd)
|
||||
{
|
||||
@@ -1402,8 +1396,11 @@ static int _dm_create_device(struct crypt_device *cd, const char *name, const ch
|
||||
goto out;
|
||||
|
||||
if (!dm_task_run(dmt)) {
|
||||
if (dm_device_exists(cd, name))
|
||||
r = dm_status_device(cd, name);;
|
||||
if (r >= 0)
|
||||
r = -EEXIST;
|
||||
if (r != -EEXIST && r != -ENODEV)
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user