diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-04-12 09:58:28 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-04-12 09:58:28 +0200 |
commit | 48924014b02dd0e8046f58a4c6c9a2903a9b1dbd (patch) | |
tree | 4623763c272cab1496fff40da3298bfb7507d48c /sysfs.c | |
parent | RebuildMap: handle missing disks (diff) | |
download | mdadm-48924014b02dd0e8046f58a4c6c9a2903a9b1dbd.tar.xz mdadm-48924014b02dd0e8046f58a4c6c9a2903a9b1dbd.zip |
Grow: fix hang when reshape completes too fast
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>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -466,6 +466,26 @@ int sysfs_get_ll(struct mdinfo *sra, struct mdinfo *dev, return 0; } +int sysfs_get_str(struct mdinfo *sra, struct mdinfo *dev, + char *name, char *buf, int buf_len) +{ + char fname[50]; + int n; + int fd; + + sprintf(fname, "/sys/block/%s/md/%s/%s", + sra->sys_name, dev?dev->sys_name:"", name); + fd = open(fname, O_RDONLY); + if (fd < 0) + return -1; + n = read(fd, buf, buf_len); + close(fd); + if (n <= 0) + return -1; + buf[n] = 0; + return 0; +} + int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms) { unsigned long sec; |