summaryrefslogtreecommitdiffstats
path: root/sysfs.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'klockwork' of git://github.com/djbw/mdadmNeilBrown2009-12-301-9/+4
|\ | | | | | | | | Conflicts: super-intel.c
| * Fix required to enable RAID arrays on SAS disks.Artur Wojcik2009-12-101-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | The patch increases the capacity of buffers used to store sysfs path names. Originally the buffers were too small to hold the canonical representation of sysfs path (in case of a SAS device, especially a device installed behind an expander). Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Reviewed-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Support external metadata recovery-resumeDan Williams2009-12-211-1/+10
| | | | | | | | | | | | | | | | | | Minimal changes needed to permit reassembling partially recovered external metadata arrays. The biggest logical change is that ->container_content() can now surface partially rebuilt members rather than omitting them from the disk list. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Teach sysfs_add_disk() callers to use ->recovery_start versus 'insync' parameterDan Williams2009-12-211-3/+3
|/ | | | | | Also fixup 'in_sync' versus 'insync' typo. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge branch 'master' into devel-3.1NeilBrown2009-10-221-2/+3
|\
| * mdmon: preserve socket over chrootDan Williams2009-10-131-2/+3
| | | | | | | | | | | | | | | | | | | | Connect to the monitor in the old namespace and use that connection for WaitClean requests when stopping the victim mdmon instance. This allows ping_monitor() to work post chroot(). Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Merge branch 'master' into devel-3.1NeilBrown2009-10-011-1/+106
|\| | | | | | | | | Conflicts: mdadm.8
| * Move WaitClean from Monitor.c to sysfs.cNeilBrown2009-06-021-0/+105
| | | | | | | | | | | | That way mdmon doesn't need to include Monitor.o Signed-off-by: NeilBrown <neilb@suse.de>
| * Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-1/+1
| | | | | | | | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* | Handle extra 'grow' variations.NeilBrown2009-08-111-8/+15
| | | | | | | | UNFINISHED
* | restripe: support saving when not all devices are present.NeilBrown2009-07-141-8/+29
|/
* Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0NeilBrown2009-04-141-0/+14
|\ | | | | | | | | | | | | | | | | Conflicts: Grow.c mdadm.h sysfs.c Due to independent fixes for the "mdadm hangs if reshape finishes too quickly" problem.
| * Grow: fix hang when reshape completes too fastDan Williams2009-04-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | For short reshapes the kernel may be done before mdadm can check that progress has passed the critical section. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * imsm: set array size at Create/AssembleDan Williams2009-04-121-0/+14
| | | | | | | | | | | | | | | | | | | | imsm arrays round down the effective array size to the closest 1 megabyte boundary so teach get_info_super_imsm and sysfs_set_array to set 'md/array_size' if available (and make sure ddf uses the default size). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | incremental_container: preserve 'in_sync' flag when adding to existing array.NeilBrown2009-04-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | When building container members with -IR, we need to ensure that devices added to an active array preserve the 'in_sync' status so they don't needlessly get rebuilt. So allow sysfs_add_disk to do this (only works in kernels since 2.6.30) and pass the relevant flag down. Signed-off-by: NeilBrown <neilb@suse.de>
* | grow: don't wait forever for critical section to pass.NeilBrown2009-04-011-0/+19
|/ | | | | | | | | | If an array reshape completed within 1 second, then --grow will not notice that it has finished and will keep waiting for the critical section to pass. So be more cautious in the test. Signed-off-by: NeilBrown <neilb@suse.de>
* sysfs: allow sysfs_read to detect and drop removed disksDan Williams2009-02-241-5/+21
| | | | | | | | | | | | | | | All operations that rely on loading from an existing container (like --add) will fail after a disk has been removed. Provide an option to skip missing / offline disks rather than abort. We attempt to do this in the load_super_{imsm,ddf}_all cases when mdmon is running i.e. we already have a consitent version of the metadata running in the system. Otherwise, we fail as normal and let the administrator fix up the container. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Abort sysfs_read early if no device found.NeilBrown2008-11-041-0/+5
| | | | | | | sysfs_read currently tried to look in sysfs even in no valid sys_name was found. Don't to that. Signed-off-by: NeilBrown <neilb@suse.de>
* Generate 'change' uevents when arrays change in non-obvious ways.NeilBrown2008-11-041-0/+16
| | | | | | | | | | | When a 'container' gets started, we need udev to notice, but the kernel has no way of knowing that a KOBJ_CHANGE event is needed. So send one directly via the 'uevent' sysfs attribute. Also, uevents don't get generated when md arrays are stopped (prior to 2.6.28) so send 'change' events then too. Signed-off-by: NeilBrown <neilb@suse.de>
* Move recently merged /sys/dev/ lookup into stat2devnum.NeilBrown2008-11-041-37/+9
| | | | | | | | But sysfs_init and stat2devnum try to convert stat information into an md devnum. Combine all the value of both pieces of code into stat2devnum and have sysfs_init call that. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.0NeilBrown2008-10-301-3/+26
|\
| * Adjust major number testing to allow for extended minor number in 2.6.28NeilBrown2008-10-301-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | From 2.6.28, normal md device will be able to have partitions. These partitions will have a different major number. Sometimes mdadm tests the major number and so can get confused. Change these tests to test against get_mdp_major(). mdp does not use extended minor number and so this test will always be accurate. Also use /sys/dev links to map major/minor to devnum in sysfs. Signed-off-by: NeilBrown <neilb@suse.de>
* | sysfs_open leaks devnum2devname() resultDan Williams2008-10-151-1/+6
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | --wait-clean: shorten timeoutDan Williams2008-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: dprintf when we fail to write a sysfs fileDan Williams2008-10-151-1/+4
| | | | | | | | | | | | | | When arrays do not startup correctly it would be nice to know why. Need to move the dprintf definition to mdadm.h Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-30/+48
| | | | | | | | | | | | | | | | | | | | When we assemble an array, there are three different approaches depending on whether metadata is internal or external, and on kernel version. Move all this to a common helper instead of duplicating in 3 places. Signed-off-by: NeilBrown <neilb@suse.de>
* | Factor out add-disk codeNeilBrown2008-09-181-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
* | sysfs: detect disks that are in the process of being removedDan Williams2008-09-151-5/+24
| | | | | | | | | | | | | | | | | | When removing a disk there is a window where the 'slot' attribute of md/dev-$name will return -EBUSY to read attempts. When this happens look at the the 'block' link, if it is removed then we can be sure the device has been removed, versus some other error. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | 'mdadm --wait-clean' wait for array to be marked cleanDan Williams2008-09-151-0/+55
| | | | | | | | | | | | | | | | | | For use in distro shutdown scripts with a RAID root file system. Returns immediately if the array is 'readonly', or not an externally managed array. It is up to the distro's scripts to make sure no new writes hit the device after this returns 'true'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-151-0/+13
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | mdmon: allow degraded arrays to be monitoredDan Williams2008-08-151-0/+6
| | | | | | | | | | | | | | manage_new is too strict in the face of failed devices. Teach it to monitor degraded arrays. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: deprecate sysfs_disk_to_sgDan Williams2008-07-241-0/+2
| | | | | | | | | | | | | | | | | | | | The cmd_filter patch merged for 2.6.27 broke retrieving the serial number via an ioctl to /dev/sgN. In debugging this I found that other utilities like sdparm simply run the ioctl on /dev/sdX. So just convert to that for protection in numbers, but scream on the mailing list for the inconvenience grr... Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: avoid possible data corruption in sys_load.NeilBrown2008-07-181-1/+1
| | | | | | | | | | | | Don't retry to remove a newline from the end of an empty string. Signed-off-by: Neil Brown <neilb@suse.de>
* | Correct readlink usage in sysfs.cNeilBrown2008-07-181-2/+4
| | | | | | | | | | | | | | readlink doesn't nul-terminate the returned string, so we must be sure to do that. Signed-off-by: Neil Brown <neilb@suse.de>
* | Introduce devname2devnumNeil Brown2008-07-121-7/+1
| | | | | | | | and use it instead of opencoding.
* | Correct unit conversion for component_size and dev/size in sysfs.Neil Brown2008-07-121-2/+2
| | | | | | | | These are both Kilobytes, so do the conversion to sectors properly.
* | Handle device removal from containerNeil Brown2008-07-121-0/+63
| | | | | | | | | | | | | | This really should be done in mdadm, not mdmon. We ensure the device won't be suddenly commited as a hot-spare using O_EXCL, then check the 'holders' sysfs directory to make sure it is only in use once.
* | Remove 'major' from superswitch.Neil Brown2008-07-121-1/+3
| | | | | | | | It isn't generally meaningful.
* | sysfs: helper routine to retrieve the scsi idDan Williams2008-06-131-0/+49
| | | | | | | | | | | | imsm records this information in its metadata Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: provide a helper function for locating scsi_generic interfacesDan Williams2008-06-131-0/+65
| | | | | | | | | | | | imsm records and validates this data in its metadata Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Add DDF code for activate_spareNeil Brown2008-06-121-0/+1
| | | | | | | | Plus various bug fixes etc.
* | Don't ignore errors in sysfs_add_disk.Neil Brown2008-06-121-5/+6
| | | | | | | | | | i.e. if the add fails, don't add the device to the internal data structures.
* | 'errno' is a positive number, not negative.Neil Brown2008-05-271-1/+1
| | | | | | | | I've been living in the kernel too long ;-)
* | Remember to close directories when we are finished with them.Neil Brown2008-05-271-1/+4
| |
* | Remove 'fd' arg from sysfs_add_diskNeil Brown2008-05-271-1/+1
| | | | | | | | | | It it never used, and removing means there are several 'open's that can go.
* | Merge mdmonNeil Brown2008-05-151-0/+29
| |
* | set resync_start in Incremental_containerDan Williams2008-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | From: Dan Williams <dan.j.williams@intel.com> Metadata handlers set mdinfo.resync_start depending on the state of the array. By default mdadm assumes the array is dirty and needs a full resync. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Create a container memberNeil Brown2008-05-151-1/+2
| | | | | | | | From: Neil Brown <neilb@suse.de>
* | More ddf stuffNeil Brown2008-05-151-0/+53
|/
* Compiple fixes for mdassemble and diet-libcNeil Brown2008-05-151-4/+4
|