mbox series

[0/9] Mdmonitor refactor and udev event handling improvements

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

Message

Mateusz Grzonka Sept. 7, 2022, 12:56 p.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.

Mateusz Grzonka (9):
  Mdmonitor: Split alert() into separate functions
  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 | 707 ++++++++++++++++++++++++++++++++----------------------
 lib.c     |  42 ----
 mdadm.h   |   6 +-
 mdopen.c  |  19 +-
 udev.c    | 191 +++++++++++++++
 udev.h    |  38 +++
 util.c    |  46 ++++
 10 files changed, 713 insertions(+), 343 deletions(-)
 create mode 100644 udev.c
 create mode 100644 udev.h

Comments

Coly Li Oct. 28, 2022, 3:42 p.m. UTC | #1
On 9/7/22 8:56 PM, 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.

Hi Mateusz,

I am not familiar with the udev stuffs, and take some time to review all 
this series. Overall I am fine with this series, except for the code 
comment style like,
/**
  * It seems not md kernel code comment style
  */


And I leave my comments in each patch, please check them.

Thanks.


Coly Li



>
> Mateusz Grzonka (9):
>    Mdmonitor: Split alert() into separate functions
>    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 | 707 ++++++++++++++++++++++++++++++++----------------------
>   lib.c     |  42 ----
>   mdadm.h   |   6 +-
>   mdopen.c  |  19 +-
>   udev.c    | 191 +++++++++++++++
>   udev.h    |  38 +++
>   util.c    |  46 ++++
>   10 files changed, 713 insertions(+), 343 deletions(-)
>   create mode 100644 udev.c
>   create mode 100644 udev.h
>