lkml.org 
[lkml]   [2006]   [Nov]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromNeil Brown <>
DateThu, 9 Nov 2006 11:17:57 +1100
SubjectRe: [PATCH 001 of 6] md: Send online/offline uevents when an md array starts/stops.
On Wednesday November 8, kay.sievers@vrfy.org wrote:
> 
> Is there a sysfs file or something similar(we could also call a md-tool)
> udev could look at, before it tries to open the device? Like:
>   KERNEL=="md*", ATTR{state}=="active", IMPORT{program}= ...

If the /sys/block/mdX directory exists at all, it is safe to open the
device-special file.  But that is racy.  It could disappear between
checking that the dir exists, and opening the device-special-file.

I still think it would make SO much sense if /sys/block/md4/dev were a
device-special-file instead of a (silly) ascii file with 9:4.  Then
this race could be closed.  But I feel that is a battle I've never
going to win.

You could look at /sys/block/mdX/md/array_state.  If that contains
'clean' or 'inactive' then there is no point opening the device.
Otherwise there might be a point, and the race would be a lot harder
to lose.

I guess it is time for me to learn about udev config files...

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-09 00:21    [W:0.218 / U:0.010 seconds]
©2003-2008 Jasper Spaans