Repository navigation
Commit 4d5324f
md: always hold reconfig_mutex when calling mddev_suspend()
Most often mddev_suspend() is called with
reconfig_mutex held. Make this a requirement in
preparation a subsequent patch. Also require
reconfig_mutex to be held for mddev_resume(),
partly for symmetry and partly to guarantee
no races with incr/decr of mddev->suspend.
Taking the mutex in r5c_disable_writeback_async() is
a little tricky as this is called from a work queue
via log->disable_writeback_work, and flush_work()
is called on that while holding ->reconfig_mutex.
If the work item hasn't run before flush_work()
is called, the work function will not be able to
get the mutex.
So we use mddev_trylock() inside the wait_event() call, and have that
abort when conf->log is set to NULL, which happens before
flush_work() is called.
We wait in mddev->sb_wait and ensure this is woken
when any of the conditions change. This requires
waking mddev->sb_wait in mddev_unlock(). This is only
like to trigger extra wake_ups of threads that needn't
be woken when metadata is being written, and that
doesn't happen often enough that the cost would be
noticeable.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>1 parent 230b55f commit 4d5324f
3 files changed
Lines changed: 24 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3628 | 3628 | | |
3629 | 3629 | | |
3630 | 3630 | | |
3631 | | - | |
| 3631 | + | |
| 3632 | + | |
3632 | 3633 | | |
| 3634 | + | |
| 3635 | + | |
3633 | 3636 | | |
3634 | 3637 | | |
3635 | 3638 | | |
| |||
3886 | 3889 | | |
3887 | 3890 | | |
3888 | 3891 | | |
3889 | | - | |
| 3892 | + | |
| 3893 | + | |
3890 | 3894 | | |
| 3895 | + | |
| 3896 | + | |
3891 | 3897 | | |
3892 | 3898 | | |
3893 | 3899 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| 361 | + | |
360 | 362 | | |
361 | 363 | | |
362 | 364 | | |
| |||
663 | 665 | | |
664 | 666 | | |
665 | 667 | | |
| 668 | + | |
666 | 669 | | |
667 | 670 | | |
668 | 671 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
696 | 698 | | |
697 | 699 | | |
698 | 700 | | |
| |||
701 | 703 | | |
702 | 704 | | |
703 | 705 | | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
709 | 715 | | |
710 | 716 | | |
711 | 717 | | |
| |||
3165 | 3171 | | |
3166 | 3172 | | |
3167 | 3173 | | |
| 3174 | + | |
| 3175 | + | |
3168 | 3176 | | |
3169 | 3177 | | |
3170 | 3178 | | |
| |||
0 commit comments