* Catching a RAID error in a process
@ 2012-07-18 20:31 Bill Davidsen
2012-07-18 23:00 ` NeilBrown
0 siblings, 1 reply; 3+ messages in thread
From: Bill Davidsen @ 2012-07-18 20:31 UTC (permalink / raw)
To: Linux RAID
Can someone point me to the docs to have a process run or notified when a RAID
event triggers? I've been playing with some recovery ideas, but polling states
and status is not the proper way to do this, and I want to test with a user
program before I start putting patches in the kernel.
--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Catching a RAID error in a process
2012-07-18 20:31 Catching a RAID error in a process Bill Davidsen
@ 2012-07-18 23:00 ` NeilBrown
2012-07-19 14:40 ` Bill Davidsen
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-07-18 23:00 UTC (permalink / raw)
To: Bill Davidsen; +Cc: Linux RAID
[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]
On Wed, 18 Jul 2012 16:31:55 -0400 Bill Davidsen <davidsen@tmr.com> wrote:
> Can someone point me to the docs to have a process run or notified when a RAID
> event triggers? I've been playing with some recovery ideas, but polling states
> and status is not the proper way to do this, and I want to test with a user
> program before I start putting patches in the kernel.
>
I guess you don't mean "run mdadm --monitor --program /bin/myscript" ??
Do you want "just any event" or some specific set of events?
See mdstat_wait in mdstat.c in the mdadm sources. It waits for any event by
using 'select' on /proc/mdstat.
void mdstat_wait(int seconds)
{
fd_set fds;
struct timeval tm;
int maxfd = 0;
FD_ZERO(&fds);
if (mdstat_fd >= 0) {
FD_SET(mdstat_fd, &fds);
maxfd = mdstat_fd;
}
tm.tv_sec = seconds;
tm.tv_usec = 0;
select(maxfd + 1, NULL, NULL, &fds, &tm);
}
mdstat_fd is a global variable
mdstat_fd = open("/proc/mdstat", O_RDONLY);
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Catching a RAID error in a process
2012-07-18 23:00 ` NeilBrown
@ 2012-07-19 14:40 ` Bill Davidsen
0 siblings, 0 replies; 3+ messages in thread
From: Bill Davidsen @ 2012-07-19 14:40 UTC (permalink / raw)
To: NeilBrown; +Cc: Linux RAID
NeilBrown wrote:
> On Wed, 18 Jul 2012 16:31:55 -0400 Bill Davidsen <davidsen@tmr.com> wrote:
>
>> Can someone point me to the docs to have a process run or notified when a RAID
>> event triggers? I've been playing with some recovery ideas, but polling states
>> and status is not the proper way to do this, and I want to test with a user
>> program before I start putting patches in the kernel.
>>
> I guess you don't mean "run mdadm --monitor --program /bin/myscript" ??
>
> Do you want "just any event" or some specific set of events?
>
> See mdstat_wait in mdstat.c in the mdadm sources. It waits for any event by
> using 'select' on /proc/mdstat.
>
> void mdstat_wait(int seconds)
> {
> fd_set fds;
> struct timeval tm;
> int maxfd = 0;
> FD_ZERO(&fds);
> if (mdstat_fd >= 0) {
> FD_SET(mdstat_fd, &fds);
> maxfd = mdstat_fd;
> }
> tm.tv_sec = seconds;
> tm.tv_usec = 0;
> select(maxfd + 1, NULL, NULL, &fds, &tm);
> }
>
>
> mdstat_fd is a global variable
> mdstat_fd = open("/proc/mdstat", O_RDONLY);
>
> NeilBrown
I would probably just use the ptail program to do it that way, I was hoping
there was some neat other way to be notified when something _bad_ happens. This
is relative to the RAID5e stuff I discussed years ago, I think I know how to do
it now, the steps work if I enter the commands manually, now I have to get a
user program to do it, and finally we can discuss the possibility of putting it
in the kernel.
--
Bill Davidsen <davidsen@tmr.com>
We are not out of the woods yet, but we know the direction and have
taken the first step. The steps are many, but finite in number, and if
we persevere we will reach our destination. -me, 2010
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-19 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 20:31 Catching a RAID error in a process Bill Davidsen
2012-07-18 23:00 ` NeilBrown
2012-07-19 14:40 ` Bill Davidsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).