Re: [PATCH] Monitor: release /proc/mdstat fd when no arrays present

From
Jes Sorensen <hidden>
Date
2016-07-21 15:37:41
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
Thread (1 message) 1 message, 1 author, last reply 2016-07-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help