File tree 1 file changed +16
-1
lines changed 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 10
10
#include <linux/string.h>
11
11
12
12
#include "do_mounts.h"
13
+ #include "../drivers/md/dm.h"
13
14
14
15
#define DM_MAX_NAME 32
15
16
#define DM_MAX_UUID 129
@@ -333,6 +334,7 @@ static void __init dm_setup_drive(void)
333
334
goto dm_table_create_fail ;
334
335
}
335
336
337
+ dm_lock_md_type (md );
336
338
target = dm_setup_args .target ;
337
339
while (target ) {
338
340
DMINFO ("adding target '%llu %llu %s %s'" ,
@@ -352,6 +354,17 @@ static void __init dm_setup_drive(void)
352
354
goto table_complete_fail ;
353
355
}
354
356
357
+ if (dm_get_md_type (md ) == DM_TYPE_NONE ) {
358
+ dm_set_md_type (md , dm_table_get_type (table ));
359
+ if (dm_setup_md_queue (md , table )) {
360
+ DMWARN ("unable to set up device queue for new table." );
361
+ goto setup_md_queue_fail ;
362
+ }
363
+ } else if (dm_get_md_type (md ) != dm_table_get_type (table )) {
364
+ DMWARN ("can't change device type after initial table load." );
365
+ goto setup_md_queue_fail ;
366
+ }
367
+
355
368
/* Suspend the device so that we can bind it to the table. */
356
369
if (dm_suspend (md , 0 )) {
357
370
DMDEBUG ("failed to suspend the device pre-bind" );
@@ -380,16 +393,18 @@ static void __init dm_setup_drive(void)
380
393
}
381
394
printk (KERN_INFO "dm: dm-%d is ready\n" , dm_setup_args .minor );
382
395
396
+ dm_unlock_md_type (md );
383
397
dm_setup_cleanup ();
384
398
return ;
385
399
386
400
export_fail :
387
401
resume_fail :
388
402
table_bind_fail :
389
403
suspend_fail :
404
+ setup_md_queue_fail :
390
405
table_complete_fail :
391
406
add_target_fail :
392
- dm_table_put ( table );
407
+ dm_unlock_md_type ( md );
393
408
dm_table_create_fail :
394
409
dm_put (md );
395
410
dm_create_fail :
You can’t perform that action at this time.
0 commit comments