Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0
mdadm
0164-mdadm-bitmap-examine-bitmap-failed-when-bi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0164-mdadm-bitmap-examine-bitmap-failed-when-bitmap-is-ex.patch of Package mdadm
From 8cc56e8b3269305ec5483527d853464eac3bf690 Mon Sep 17 00:00:00 2001 From: Zhilong Liu <zlliu@suse.com> Date: Mon, 28 Aug 2017 17:24:27 +0800 Subject: [PATCH] mdadm/bitmap: examine-bitmap failed when bitmap is external mode Git-commit: 8cc56e8b3269305ec5483527d853464eac3bf690 Patch-mainline: mdadm-4.0+ References: bsc#1069165, bsc#1069167, bsc#1068030 --examine-bitmap: the bitmap_file_open() shouldn't omit the regular file descriptor when the bitmap is external mode. Such as: ./mdadm -X /mnt/3 This commit is partial revert of commit 0a6bff09d416 (mdadm/util: unify fstat checking blkdev into function) Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com> Signed-off-by: Coly Li <colyli@suse.de> --- bitmap.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bitmap.c b/bitmap.c index 3653660..e38cb96 100644 --- a/bitmap.c +++ b/bitmap.c @@ -183,6 +183,7 @@ static int bitmap_file_open(char *filename, struct supertype **stp, int node_num) { int fd; + struct stat stb; struct supertype *st = *stp; fd = open(filename, O_RDONLY|O_DIRECT); @@ -192,7 +193,12 @@ bitmap_file_open(char *filename, struct supertype **stp, int node_num) return -1; } - if (fstat_is_blkdev(fd, filename, NULL)) { + if (fstat(fd, &stb) < 0) { + pr_err("fstat failed for %s: %s\n", filename, strerror(errno)); + close(fd); + return -1; + } + if ((stb.st_mode & S_IFMT) == S_IFBLK) { /* block device, so we are probably after an internal bitmap */ if (!st) st = guess_super(fd); @@ -211,11 +217,7 @@ bitmap_file_open(char *filename, struct supertype **stp, int node_num) fd = -1; } } - *stp = st; - } else { - close(fd); - return -1; } return fd; -- 2.13.6
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