Tomasz Majchrzak [off-list ref] writes:
If md kernel module is reloaded, /proc/mdstat cannot be accessed ("cat:
/proc/mdstat: No such file or directory"). The reason is mdadm monitor
still holds a file descriptor to previous /proc/mdstat instance. It
leads to really confusing outcome of the following operations - mdadm
seems to run without errors, however some udev rules don't get executed
and new array doesn't work.
Add a check if lseek was successful as it fails if md kernel module has
been unloaded - close a file descriptor then. The problem is mdadm
monitor doesn't always do it before next operation takes place. To
prevent it monitor always releases /proc/mdstat descriptor when there
are no arrays to be monitored, just in case driver unload happens in a
moment.
Signed-off-by: Tomasz Majchrzak <redacted>
Reviewed-by: Artur Paszkiewicz <redacted>
---
Monitor.c | 2 ++
mdstat.c | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
Looks good, applied!
Thanks,
Jes