summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Release mdadm-3.4mdadm-3.4NeilBrown2016-01-288-8/+35
| | | | | | My last release! Signed-off-by: NeilBrown <neilb@suse.com>
* Assorted fixed for a "make everything" buildNeilBrown2016-01-284-15/+28
| | | | Signed-off-by: NeilBrown <neilb@suse.com>
* super1: allow reshape that hasn't really started to be reverted.NeilBrown2016-01-282-2/+28
| | | | | | | | | | | | A simple revert doesn't work here because the reshape_position is in the critical section. The best approach is to let the reshape progress a bit and then go backwards. If that isn't possible, assembling with --update=revert-reshape and --invalid-backup should work. Reported-by-tested-by: George Rapp <george.rapp@gmail.com> Signed-off-by: NeilBrown <neilb@suse.com>
* super0: Fix reporting of devices between 2GB and 4GBNeilBrown2016-01-282-3/+5
| | | | | | | | v0.90 metadata can handle devices between 2GB and 4GB, but we need to treat the 'size' and unsigned. In a couple of places we don't. URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809447 Signed-off-by: NeilBrown <neilb@suse.com>
* systemd/mdadm-last-resort: add Conflicts to .service file.NeilBrown2016-01-281-0/+1
| | | | | | | | | | | It seems that having the Conflicts in the .timer file is not sufficient. Sometimes it works, but if the timer gets requested after the conflicting block device appears (or was it "before" ...) the timer is not aborted. Having the Conflicts in both files seems to work reliably. URL: https://bugzilla.suse.com/show_bug.cgi?id=853944 Signed-off-by: NeilBrown <neilb@suse.com>
* super1: fix calculation of space_beforeNeilBrown2016-01-281-1/+1
| | | | | | | | | This code was meant to update 'earliest' but clearly never doesn't. This bug would only affect an array with a very large bitmap so it is unlikely to be significant. Signed-off-by: NeilBrown <neilb@suse.com>
* util: fix wrong return value of cluster_get_dlmlockGuoqing Jiang2016-01-271-10/+4
| | | | | | | Actually lksb.sb_status means that a node got the lock or not instead of the return value of dlm_lock. Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
* Add casts for the addr arg of connect and bindKhem Raj2016-01-152-2/+2
| | | | | | | | | | glibc allows the addr arg to connect and socket to be any of a number of 'sockaddr_*' types, but musl requires 'const struct sockaddr *' which is in line with open group specs. So add casts to allow compilation with musl. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Define _POSIX_C_SOURCE if undefinedKhem Raj2016-01-151-0/+3
| | | | | | | | | config.c uses _POSIX_C_SOURCE which is defined in features.h when glibc/uclibc is used, but isn't defined when musl is used. So provide a reasonable default. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Create: minor fix when adding a journal deviceNeilBrown2016-01-141-2/+3
| | | | | | | | | The check of "is there a filesystem here" is still appropriate for a journal device. Also set active_disks correctly - even though it is ignored. Signed-off-by: NeilBrown <neilb@suse.com>
* Create: fix regression in setting raid_diskNeilBrown2016-01-141-1/+4
| | | | | | | Recent commit caused 'missing' declarations to not be handled correctly. Fixes: cc1799c3ddc9 ("Enable create array with write journal (--write-journal DEVICE).") Signed-off-by: NeilBrown <neilb@suse.com>
* restripe: fix compilation of "make test"NeilBrown2016-01-132-4/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.com>
* Fix wrong description in manpageGuoqing Jiang2016-01-131-4/+4
| | | | | | | | | The careless change was introduce by 'commit 7e6e839a2651 (mdadm: change the num of cluster node)'. Which should be revert to avoid misunderstanding. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* imsm: don't update migration record when reshape is interruptedArtur Paszkiewicz2016-01-071-2/+2
| | | | | | | | | | Abort imsm_manage_reshape() without updating the migration record if any error occurs when checking progress. If reshape is interrupted and the migration record is then updated, the checkpoint will be wrong and will cause reshape to fail when the array is restarted. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
* imsm: use timeout when waiting for reshape progressArtur Paszkiewicz2016-01-071-1/+2
| | | | | | | | | | | | | Waiting for reshape progress is done by using select() on sync_completed to block until an exception condition is signalled on the filedescriptor. This happens when the attribute's value is updated by the kernel, but if the array is stopped when mdadm is blocked on select() this will never happen, because this attribute is then removed and apparently the kernel doesn't do sysfs_notify() when removing a sysfs attribute. So set a 3 second timeout for the sysfs_wait() call. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
* IMSM: Add support for VMDPawel Baldysiak2016-01-063-21/+194
| | | | | | | | | | | | | The Intel Volume Management Device (VMD) is an integrated endpoint on the platform's PCIe root complex that acts as a host bridge to a secondary PCIe domain. This patch adds proper handling of NVMe devices attached to VMD domain. Each VMD domain is treated as a separate controller (HBA). Spanning between domains is forbidden. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
* imsm: abort reshape if sync_action is not "reshape"Artur Paszkiewicz2015-12-241-2/+4
| | | | | | | | | | When reshape was interrupted, an incorrect checkpoint would be saved in the migration record. Change wait_for_reshape_imsm() to return -1 when sync_action is not "reshape" to abort early in imsm_manage_reshape() without writing the migration record. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Grow: close file descriptor earlier to avoid "still in use" when stoppingArtur Paszkiewicz2015-12-241-0/+3
| | | | | | | | | | | Close fd2 as soon as it is no longer needed, before calling Grow_continue(). Otherwise, we won't be able to stop an array with external metadata during reshape, because mdadm running in background will be keeping it open. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Detail: fix wrong condition in recent change.NeilBrown2015-12-231-1/+1
| | | | | | | | | Now that we can print device details with a specific raid_disk but not disk.number, the condition for "print either disk.number or disk.raid_disk" must be make more specific. Reported-by: Coly Li <colyli@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Check and remove bitmap first when reshape to raid0Xiao Ni2015-12-221-0/+9
| | | | | | | | | If reshape one raid device with bitmap to raid0, the reshape progress will start. But it'll fail and lose some components. So it should remove bitmap first. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com>
* in --add assign raid_disk of 0 to journalSong Liu2015-12-221-1/+1
| | | | | | Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* move journal to end of --detail listSong Liu2015-12-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | As we give journal device raid_disk of 0, the output of --detail is: Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 5 8 24 0 journal /dev/sdb8 1 8 18 1 active sync /dev/sdb2 2 8 19 2 active sync /dev/sdb3 3 8 21 3 active sync /dev/sdb5 4 8 23 - spare /dev/sdb7 This patch makes it back to: Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 18 1 active sync /dev/sdb2 2 8 19 2 active sync /dev/sdb3 3 8 21 3 active sync /dev/sdb5 4 8 23 - spare /dev/sdb7 5 8 24 - journal /dev/sdb8 Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Add --update=force-no-bbl.NeilBrown2015-12-213-3/+12
| | | | | | | This forcibly removed the bad-block log. There can be situations where it is hard to remove bad blocks by writing to them - partiularly on RAID5. Signed-off-by: NeilBrown <neilb@suse.com>
* Merge branch 'fix-unlikely-potential-overflows' of https://github.com/sjvs/mdadmNeilBrown2015-12-212-5/+5
|\
| * make sure 'path' buffer is large enough to fit 200 characters plus null ↵Bas van Schaik2015-12-031-1/+1
| | | | | | | | terminator
| * avoid confusion with parameter 'devname' with same name, ensure buffer is ↵Bas van Schaik2015-12-031-3/+3
| | | | | | | | large enough for two ints plus extras
| * ensure buffer is large enough for two ints and some extrasBas van Schaik2015-12-031-1/+1
| |
* | Merge https://github.com/makelinux/mdadmNeilBrown2015-12-211-4/+2
|\ \ | | | | | | | | | Fixes https://github.com/neilbrown/mdadm/issues/17
| * | Detail.c --test fixConstantine Shulyupin2015-12-101-4/+2
| |/
* | Detail: don't assume a particular 'disk' number of missing devices.NeilBrown2015-12-181-1/+5
| | | | | | | | | | | | | | | | | | | | When a particular raid-disk is missing, we don't know which disk number it should have, and reporting a number could result in duplicate numbers (with v1.x metadata - never with the old 0.90). So set the default to -1 and recoginise that when printing. Signed-off-by: NeilBrown <neilb@suse.com>
* | Detail: report correct raid-disk for removed drives.NeilBrown2015-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | Back in Commit: 8057db46a15d ("Detail: fix handling of 'disks' array.") when we doubled the size of the 'disks' array to handle primary and replacement, we should have halved the setting of the default raid_disk number. Reported-by: Coly Li <colyli@suse.de> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: improve the safeguard for change cluster raid's sbGuoqing Jiang2015-12-173-30/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit does the following jobs: 1. rename is_clustered to dlm_funs_ready since it match the function better. 2. st->cluster_name can't be use to identify the raid is a clustered or not, we should check the bitmap's version to perform the identification. 3. for cluster_get_dlmlock/cluster_release_dlmlock funcs, both of them just need the lockid as parameter since the cluster name can get by get_cluster_name(). Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: do not try to hold dlm lock in free_super1Guoqing Jiang2015-12-171-11/+0
| | | | | | | | | | | | | | | | | | | | | | Since free_super1 actually doesn't change the sb, it just free the addr space of sb. Also free_super1 is called in lots of place within mdadm, so remove dlm lock code since the func doesn't need the protection and also reduce latency. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: do not display bitmap info if it is clearedGuoqing Jiang2015-12-164-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | "mdadm -X DISK" is used to report information about a bitmap file, it is better to not display all the related infos if bitmap is cleared with "--bitmap=none" under grow mode. To do that, the locate_bitmap is changed a little to have a return value based on MD_FEATURE_BITMAP_OFFSET. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: don't show cluster name once the bitmap is clearedGuoqing Jiang2015-12-161-2/+2
| | | | | | | | | | | | | | Don't show cluster name if bitmap is cleared. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: output info more precisely when change bitmap to noneGuoqing Jiang2015-12-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | WHen change bitmap to none, the infos could be more accurate based on existed bitmap type. And s->bitmap_file is passed from cmd "--bitmap=TYPE", so remove s->bitmap_file from err info since it should means change the bitmap to one type failed rather than the type is already presented. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: let cluster raid could also add disk within incremental modeGuoqing Jiang2015-12-161-0/+4
| | | | | | | | | | | | | | | | | | For cluster raid, the disc.state need to be changed accordingly under incremental mode. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | recreate journal in mdadmSong Liu2015-12-165-4/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch tries recreates missing/faulty journal in mdadm. Example: ./mdadm --fail /dev/md1 /dev/sdb2 mdadm: set /dev/sdb2 faulty in /dev/md1 ./mdadm --stop /dev/md1 mdadm: stopped /dev/md1 ./mdadm -A --scan --force mdadm: Journal is missing or stale, starting array read only. mdadm: /dev/md/1 has been started with 15 drives. ./mdadm --add-journal /dev/md1 /dev/sdb2 mdadm: added /dev/sdb2 Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | add sysfs_array_state to struct mdinfoSong Liu2015-12-162-0/+11
| | | | | | | | | | | | | | | | | | Add sysfs_array_state to struct mdinfo, and add GET_ARRAY_STATE to options of sysfs_read. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | mdadm: Change timestamps to unsigned data type.Deepa Dinamani2015-12-163-4/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 32 bit signed timestamps will overflow in the year 2038. Change the user interface mdu_array_info_s structure timestamps: ctime and utime values used in ioctls GET_ARRAY_INFO and SET_ARRAY_INFO to unsigned int. This will extend the field to last until the year 2106. Add time_after/time_before and supporting typecheck from the kernel to take care of unsigned time wraparound. The long term plan is to get rid of ctime and utime values in this structure as this information can be read from the on-disk meta data directly. v0.90 on disk meta data uses u32 for maintaining time stamps. So this will also last until year 2106. Assumption is that the usage of v0.90 will be deprecated by year 2106. Timestamp fields in the on disk meta data for v1.0 version already use 64 bit data types. Signed-off-by: NeilBrown <neilb@suse.com>
* | fix bug in assembleSong Liu2015-12-091-1/+4
| | | | | | | | | | | | | | | | | | | | In Assemble, getinfo_super() over-writes journal_clean. To ensure correct journal_clean, keep it in a local variable before getinfo_super(). Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* | add crc32c and use it for r5l checksumSong Liu2015-10-303-8/+109
|/ | | | | | | | | | | | | In kernel space, r5l checksum will use crc32c: http://marc.info/?l=linux-raid&m=144598970529191 mdadm need to change too. This patch ports a simplified crc32c algorithm from kernel code, and used in super1.c:write_empty_r5l_meta_block(); Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: add test script for raid456 journalSong Liu2015-10-222-0/+73
| | | | | | Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: Add description of write journal to md.4Song Liu2015-10-221-0/+20
| | | | | | Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: refactor write journal code in Assemble and IncrementalSong Liu2015-10-224-56/+19
| | | | | | | | | | | | | | | | | | As discussed, standalone require_journal() in struct superswitch is not a very good idea. Instead, journal related information fits well in struct mdinfo. This patch simplifies journal support code in Assemble and Incremental as: - Add journal_device_required and journal_clean to struct mdinfo; - Remove function require_journal from struct superswitch; - Update Assemble and Incremental to use journal_device_required and journal_clean from struct mdinfo (instead of separate var). Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Make cmap_* also has same policy as dlm_*Guoqing Jiang2015-10-213-36/+56
| | | | | | | | Let libcmap lib and related funs also only need one-time setup during mdadm running period. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Safeguard against writing to an active device of another nodeGuoqing Jiang2015-10-215-1/+248
| | | | | | | | | | | | | | Modifying an exiting device's superblock or creating a new superblock on an existing device needs to be checked because the device could be in use by another node in another array. So, we check this by taking all superblock locks in userspace so that we don't step onto an active device used by another node and safeguard against accidental edits. After the edit is complete, we release all locks and the lockspace so that it can be used by the kernel space. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Add help message and man entry for --write-journalSong Liu2015-10-192-0/+7
| | | | | | Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Check write journal in incrementalSong Liu2015-10-191-4/+27
| | | | | | | | | | | | | | | | | | | | | | If journal device is missing, do not start the array, and shows: ./mdadm -I /dev/sdf mdadm: journal device is missing, not safe to start yet. The array will be started when the journal device is attached with -I ./mdadm -I /dev/sdb1 mdadm: /dev/sdb1 attached to /dev/md/0_0, which has been started. To force start without journal device: ./mdadm -I /dev/sdf --run mdadm: Trying to run with missing journal device mdadm: /dev/sdf attached to /dev/md/0_0, which has been started. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Assemble array with write journalSong Liu2015-10-193-16/+81
| | | | | | | | | | | | | | | | | | | | | | | Example output: ./mdadm --assemble /dev/md0 /dev/sd[c-f] /dev/sdb1 mdadm: /dev/md0 has been started with 4 drives and 1 journal. mdadm checks superblock for journal devices. If the journal device is missing or faulty, mdadm will show warning ./mdadm --assemble /dev/md0 /dev/sd[c-q] /dev/sdb1 mdadm: Not safe to assemble with missing or stale journal device, consider --force. User can insist to start the array (read only) with --force ./mdadm --assemble /dev/md0 /dev/sd[c-q] /dev/sdb1 --force mdadm: Journal is missing or stale, starting array read only. mdadm: /dev/md0 has been started with 15 drives. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>