Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:Update
mdadm.3522
0002-imsm-properly-handle-values-of-sync_comple...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-imsm-properly-handle-values-of-sync_completed.patch of Package mdadm.3522
From 0febb20c458a488460eadade74a6c283aadaf96a Mon Sep 17 00:00:00 2001 From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> Date: Thu, 16 Jun 2016 11:31:37 +0200 Subject: [PATCH] imsm: properly handle values of sync_completed The sync_completed can be set to such values: - two numbers of processed sectors and total during synchronization, separated with '/'; - 'none' if synchronization process is stopped; - 'delayed' if synchronization process is delayed. Handle value of sync_completed not only as numbers but also check for 'none' and 'delayed'. Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> --- super-intel.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) --- a/super-intel.c +++ b/super-intel.c @@ -10345,6 +10345,33 @@ exit_imsm_reshape_super: return ret_val; } +#define COMPLETED_OK 0 +#define COMPLETED_NONE 1 +#define COMPLETED_DELAYED 2 + +static int read_completed(int fd, unsigned long long *val) +{ + int ret; + char buf[50]; + + ret = sysfs_fd_get_str(fd, buf, 50); + if (ret < 0) + return ret; + + ret = COMPLETED_OK; + if (strncmp(buf, "none", 4) == 0) { + ret = COMPLETED_NONE; + } else if (strncmp(buf, "delayed", 7) == 0) { + ret = COMPLETED_DELAYED; + } else { + char *ep; + *val = strtoull(buf, &ep, 0); + if (ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' ')) + ret = -1; + } + return ret; +} + /******************************************************************************* * Function: wait_for_reshape_imsm * Description: Function writes new sync_max value and waits until @@ -10392,8 +10419,10 @@ int wait_for_reshape_imsm(struct mdinfo } do { + int rc; char action[20]; int timeout = 3000; + sysfs_wait(fd, &timeout); if (sysfs_get_str(sra, NULL, "sync_action", action, 20) > 0 && @@ -10403,11 +10432,14 @@ int wait_for_reshape_imsm(struct mdinfo close(fd); return -1; } - if (sysfs_fd_get_ll(fd, &completed) < 0) { + + rc = read_completed(fd, &completed); + if (rc < 0) { dprintf("cannot read reshape_position (in loop)\n"); close(fd); return 1; - } + } else if (rc == COMPLETED_NONE) + break; } while (completed < position_to_set); close(fd);
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