Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
mdadm
0001-re-add-make-re-add-try-to-write-sysfs-node...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-re-add-make-re-add-try-to-write-sysfs-node-first.patch of Package mdadm
From 5ff8b38a613961f84da8e80be9d20ede622fc8fc Mon Sep 17 00:00:00 2001 From: Guoqing Jiang <gqjiang@suse.com> Date: Tue, 29 Sep 2015 16:11:36 +0800 Subject: [PATCH] re-add: make re-add try to write sysfs node first If sysfs node existed, we should try to write "re-add" to it. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> --- Manage.c | 13 +++++++++++++ mdadm.h | 1 + sysfs.c | 6 ++++++ 3 files changed, 20 insertions(+) --- a/Manage.c +++ b/Manage.c @@ -1313,6 +1313,7 @@ int Manage_subdevs(char *devname, int fd int sysfd = -1; int count = 0; /* number of actions taken */ struct mdinfo info; + struct mdinfo devinfo; int frozen = 0; int busy = 0; int raid_slot = -1; @@ -1520,6 +1521,18 @@ int Manage_subdevs(char *devname, int fd " operation on the parent container\n"); goto abort; } + + /* Let's first try to write re-add to sysfs */ + if (stb.st_rdev != 0 && + (dv->disposition == 'A' || dv->disposition == 'F')) { + sysfs_init_dev(&devinfo, stb.st_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); + break; + } + } + if (dv->disposition == 'F') { /* Need to remove first */ int err; --- a/mdadm.h +++ b/mdadm.h @@ -553,6 +553,7 @@ enum sysfs_read_flags { */ extern int sysfs_open(char *devnm, char *devname, char *attr); extern void sysfs_init(struct mdinfo *mdi, int fd, char *devnm); +extern void sysfs_init_dev(struct mdinfo *mdi, unsigned long devid); extern void sysfs_free(struct mdinfo *sra); extern struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options); extern int sysfs_attr_match(const char *attr, const char *str); --- a/sysfs.c +++ b/sysfs.c @@ -74,6 +74,12 @@ int sysfs_open(char *devnm, char *devnam return fd; } +void sysfs_init_dev(struct mdinfo *mdi, unsigned long devid) +{ + snprintf(mdi->sys_name, + sizeof(mdi->sys_name), "dev-%s", devid2kname(devid)); +} + void sysfs_init(struct mdinfo *mdi, int fd, char *devnm) { mdi->sys_name[0] = 0;
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