Commit 6751fb3c0e0cfcc40a1a0acabca97370c9ec6c6b

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 7b389b2cc5

padata: Use get_online_cpus/put_online_cpus

This patch puts get_online_cpus/put_online_cpus around the places
we modify the padata cpumask to ensure that no cpu goes offline
during this operation.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 13 additions and 0 deletions Side-by-side Diff

... ... @@ -441,6 +441,8 @@
441 441  
442 442 mutex_lock(&pinst->lock);
443 443  
  444 + get_online_cpus();
  445 +
444 446 pd = padata_alloc_pd(pinst, cpumask);
445 447 if (!pd) {
446 448 err = -ENOMEM;
... ... @@ -452,6 +454,8 @@
452 454 padata_replace(pinst, pd);
453 455  
454 456 out:
  457 + put_online_cpus();
  458 +
455 459 mutex_unlock(&pinst->lock);
456 460  
457 461 return err;
458 462  
... ... @@ -485,8 +489,10 @@
485 489  
486 490 mutex_lock(&pinst->lock);
487 491  
  492 + get_online_cpus();
488 493 cpumask_set_cpu(cpu, pinst->cpumask);
489 494 err = __padata_add_cpu(pinst, cpu);
  495 + put_online_cpus();
490 496  
491 497 mutex_unlock(&pinst->lock);
492 498  
493 499  
... ... @@ -521,8 +527,10 @@
521 527  
522 528 mutex_lock(&pinst->lock);
523 529  
  530 + get_online_cpus();
524 531 cpumask_clear_cpu(cpu, pinst->cpumask);
525 532 err = __padata_remove_cpu(pinst, cpu);
  533 + put_online_cpus();
526 534  
527 535 mutex_unlock(&pinst->lock);
528 536  
... ... @@ -626,6 +634,8 @@
626 634 if (!pinst)
627 635 goto err;
628 636  
  637 + get_online_cpus();
  638 +
629 639 pd = padata_alloc_pd(pinst, cpumask);
630 640 if (!pd)
631 641 goto err_free_inst;
... ... @@ -647,6 +657,8 @@
647 657 register_hotcpu_notifier(&pinst->cpu_notifier);
648 658 #endif
649 659  
  660 + put_online_cpus();
  661 +
650 662 mutex_init(&pinst->lock);
651 663  
652 664 return pinst;
... ... @@ -655,6 +667,7 @@
655 667 padata_free_pd(pd);
656 668 err_free_inst:
657 669 kfree(pinst);
  670 + put_online_cpus();
658 671 err:
659 672 return NULL;
660 673 }