Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
mdadm.7129
0072-Increase-buffer-for-sysfs-disk-state.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0072-Increase-buffer-for-sysfs-disk-state.patch of Package mdadm.7129
From cf52eff58ab9d08e3d016c4f22da8adfc295d7e0 Mon Sep 17 00:00:00 2001 From: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Date: Thu, 27 Oct 2016 11:34:16 +0200 Subject: [PATCH 328/359] Increase buffer for sysfs disk state References: bsc#1081910 Bad block support has incremented sysfs disk state reported by kernel ("external_bbl") so it became longer than 20 bytes. It causes reshape to fail as it reads truncated entry from sysfs. Increase buffer so it can accommodate the string including all state values currently implemented in kernel at the same time. Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Coly Li <colyli@suse.de> --- Grow.c | 6 ++++-- monitor.c | 4 ++-- super-intel.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Grow.c b/Grow.c index a8f6243..455c5f9 100755 --- a/Grow.c +++ b/Grow.c @@ -4048,8 +4048,10 @@ static int grow_backup(struct mdinfo *sra, if (sd->disk.state & (1<<MD_DISK_FAULTY)) continue; if (sd->disk.state & (1<<MD_DISK_SYNC)) { - char sbuf[20]; - if (sysfs_get_str(sra, sd, "state", sbuf, 20) < 0 || + char sbuf[100]; + + if (sysfs_get_str(sra, sd, "state", + sbuf, sizeof(sbuf)) < 0 || strstr(sbuf, "faulty") || strstr(sbuf, "in_sync") == NULL) { /* this device is dead */ diff --git a/monitor.c b/monitor.c index 4c79ce2..3c554ab 100644 --- a/monitor.c +++ b/monitor.c @@ -131,8 +131,8 @@ static enum sync_action read_action( int fd) int read_dev_state(int fd) { - char buf[60]; - int n = read_attr(buf, 60, fd); + char buf[100]; + int n = read_attr(buf, sizeof(buf), fd); char *cp; int rv = 0; diff --git a/super-intel.c b/super-intel.c index 1f79eab..5740088 100644 --- a/super-intel.c +++ b/super-intel.c @@ -10708,9 +10708,10 @@ int check_degradation_change(struct mdinfo *info, if (sd->disk.state & (1<<MD_DISK_FAULTY)) continue; if (sd->disk.state & (1<<MD_DISK_SYNC)) { - char sbuf[20]; + char sbuf[100]; + if (sysfs_get_str(info, - sd, "state", sbuf, 20) < 0 || + sd, "state", sbuf, sizeof(sbuf)) < 0 || strstr(sbuf, "faulty") || strstr(sbuf, "in_sync") == NULL) { /* this device is dead */ -- 2.16.1
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