Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
mdadm.1739
0003-Manage-fix-removal-of-non-existent-devices...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Manage-fix-removal-of-non-existent-devices.patch of Package mdadm.1739
From b47024f1c5fde5d4fbc65807b9b29e06c056584e Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Mon, 11 Aug 2014 10:30:42 +1000 Subject: [PATCH 3/3] Manage: fix removal of non-existent devices. "--remove detached" and others stopped working a while back when I refactored some code. For 'remove' and 'fail', the device may not exist so if it is "MM:mm", (e.g. added by "detached"), just parse out the numbers. Reported-by: Killian De Volder <killian.de.volder@megasoft.be> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Coly Li <colyli@suse.de> --- Manage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/Manage.c +++ b/Manage.c @@ -1342,6 +1342,7 @@ int Manage_subdevs(char *devname, int fd for (dv = devlist; dv; dv = dv->next) { unsigned long rdev = 0; /* device to add/remove etc */ int rv; + int mj,mn; raid_slot = -1; if (dv->disposition == 'c') { @@ -1450,7 +1451,6 @@ int Manage_subdevs(char *devname, int fd sysfd = sysfs_open(fd2devnm(fd), dname, "block/dev"); if (sysfd >= 0) { char dn[20]; - int mj,mn; if (sysfs_fd_get_str(sysfd, dn, 20) > 0 && sscanf(dn, "%d:%d", &mj,&mn) == 2) { rdev = makedev(mj,mn); @@ -1468,6 +1468,12 @@ int Manage_subdevs(char *devname, int fd goto abort; } } + } else if ((dv->disposition == 'r' || dv->disposition == 'f') + && get_maj_min(dv->devname, &mj, &mn)) { + /* for 'fail' and 'remove', the device might + * not exist. + */ + rdev = makedev(mj, mn); } else { struct stat stb; tfd = dev_open(dv->devname, O_RDONLY); @@ -1524,9 +1530,9 @@ int Manage_subdevs(char *devname, int fd } /* Let's first try to write re-add to sysfs */ - if (stb.st_rdev != 0 && + if (rdev != 0 && (dv->disposition == 'A' || dv->disposition == 'F')) { - sysfs_init_dev(&devinfo, stb.st_rdev); + sysfs_init_dev(&devinfo, rdev); if (sysfs_set_str(&info, &devinfo, "state", "re-add") == 0) { pr_err("re-add %s to %s succeed\n", dv->devname, info.sys_name);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor