mbox series

[v3,0/8] Mdmonitor refactor and udev event handling improvements

Message ID 20230202112706.14228-1-mateusz.grzonka@intel.com (mailing list archive)
Headers show
Series Mdmonitor refactor and udev event handling improvements | expand

Message

Mateusz Grzonka Feb. 2, 2023, 11:26 a.m. UTC
Along the way we observed many problems with current approach to event handling in mdmonitor.
It frequently doesn't report Fail and DeviceDisappeared events.
It's due to time races with udev, and too long delay in some cases.
While there was a patch intending to address time races with udev, it didn't remove them completely.
This patch series presents alternative approach, where mdmonitor wakes up on udev events, so that
there should be no more conflicts with udev we saw before.

Additionally some code quality improvements were done, to make the code more maintainable.

v2:
Fixed mismatched comment style and rebased onto master.

v3:
Resend to cleanup on patchwork.

Mateusz Grzonka (8):
  Mdmonitor: Make alert_info global
  Mdmonitor: Pass events to alert() using enums instead of strings
  Mdmonitor: Add helper functions
  Add helpers to determine whether directories or files are soft links
  Mdmonitor: Refactor write_autorebuild_pid()
  Mdmonitor: Refactor check_one_sharer() for better error handling
  Mdmonitor: Improve udev event handling
  udev: Move udev_block() and udev_unblock() into udev.c

 Create.c  |   1 +
 Makefile  |   3 +-
 Manage.c  |   3 +-
 Monitor.c | 623 +++++++++++++++++++++++++++++++++---------------------
 lib.c     |  42 ----
 mdadm.h   |   5 +-
 mdopen.c  |  19 +-
 udev.c    | 191 +++++++++++++++++
 udev.h    |  38 ++++
 util.c    |  45 ++++
 10 files changed, 668 insertions(+), 302 deletions(-)
 create mode 100644 udev.c
 create mode 100644 udev.h

Comments

Jes Sorensen March 2, 2023, 4 p.m. UTC | #1
On 2/2/23 06:26, Mateusz Grzonka wrote:
> Along the way we observed many problems with current approach to event handling in mdmonitor.
> It frequently doesn't report Fail and DeviceDisappeared events.
> It's due to time races with udev, and too long delay in some cases.
> While there was a patch intending to address time races with udev, it didn't remove them completely.
> This patch series presents alternative approach, where mdmonitor wakes up on udev events, so that
> there should be no more conflicts with udev we saw before.
> 
> Additionally some code quality improvements were done, to make the code more maintainable.
> 
> v2:
> Fixed mismatched comment style and rebased onto master.
> 
> v3:
> Resend to cleanup on patchwork.
> 
> Mateusz Grzonka (8):
>   Mdmonitor: Make alert_info global
>   Mdmonitor: Pass events to alert() using enums instead of strings
>   Mdmonitor: Add helper functions
>   Add helpers to determine whether directories or files are soft links
>   Mdmonitor: Refactor write_autorebuild_pid()
>   Mdmonitor: Refactor check_one_sharer() for better error handling
>   Mdmonitor: Improve udev event handling
>   udev: Move udev_block() and udev_unblock() into udev.c

Hi Mateusz,

1-6 applied, 7+8 don't build on Fedora 36.

Thanks,
Jes
Grzonka, Mateusz July 5, 2023, 3:15 p.m. UTC | #2
On 3/2/2023 5:00 PM, Jes Sorensen wrote:
> On 2/2/23 06:26, Mateusz Grzonka wrote:
>> Along the way we observed many problems with current approach to event handling in mdmonitor.
>> It frequently doesn't report Fail and DeviceDisappeared events.
>> It's due to time races with udev, and too long delay in some cases.
>> While there was a patch intending to address time races with udev, it didn't remove them completely.
>> This patch series presents alternative approach, where mdmonitor wakes up on udev events, so that
>> there should be no more conflicts with udev we saw before.
>>
>> Additionally some code quality improvements were done, to make the code more maintainable.
>>
>> v2:
>> Fixed mismatched comment style and rebased onto master.
>>
>> v3:
>> Resend to cleanup on patchwork.
>>
>> Mateusz Grzonka (8):
>>    Mdmonitor: Make alert_info global
>>    Mdmonitor: Pass events to alert() using enums instead of strings
>>    Mdmonitor: Add helper functions
>>    Add helpers to determine whether directories or files are soft links
>>    Mdmonitor: Refactor write_autorebuild_pid()
>>    Mdmonitor: Refactor check_one_sharer() for better error handling
>>    Mdmonitor: Improve udev event handling
>>    udev: Move udev_block() and udev_unblock() into udev.c
> 
> Hi Mateusz,
> 
> 1-6 applied, 7+8 don't build on Fedora 36.
> 
> Thanks,
> Jes
> 

Hi Jes,

sorry for the late response,
I fixed the two last patches and marked the series as v4.

Thanks,
Mateusz