summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-12-12 17:22:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-12-12 17:22:10 +0000
commit55526d6577f82349bf6bb59816680d7483b61dff (patch)
tree456f8e2360e6bbd83e4f9a571f97cda281e4d9d9 /bitmap.c
parentReleasing debian version 4.3+20241108-1. (diff)
downloadmdadm-55526d6577f82349bf6bb59816680d7483b61dff.tar.xz
mdadm-55526d6577f82349bf6bb59816680d7483b61dff.zip
Merging upstream version 4.3+20241202.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/bitmap.c b/bitmap.c
index 5110ae2..c62d18d 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -200,28 +200,32 @@ bitmap_file_open(char *filename, struct supertype **stp, int node_num, int fd)
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);
- if (!st) {
- /* just look at device... */
- lseek(fd, 0, 0);
- } else if (!st->ss->locate_bitmap) {
- pr_err("No bitmap possible with %s metadata\n",
- st->ss->name);
- close(fd);
- return -1;
- } else {
- if (st->ss->locate_bitmap(st, fd, node_num)) {
- pr_err("%s doesn't have bitmap\n", filename);
- close(fd);
- fd = -1;
- }
- }
- *stp = st;
+
+ if ((stb.st_mode & S_IFMT) != S_IFBLK) {
+ pr_err("bitmap file is not supported %s\n", filename);
+ close(fd);
+ return -1;
+ }
+
+ if (!st)
+ st = guess_super(fd);
+
+ if (!st) {
+ /* just look at device... */
+ lseek(fd, 0, 0);
+ } else if (!st->ss->locate_bitmap) {
+ pr_err("No bitmap possible with %s metadata\n", st->ss->name);
+ close(fd);
+ return -1;
+ }
+
+ if (st->ss->locate_bitmap(st, fd, node_num)) {
+ pr_err("%s doesn't have bitmap\n", filename);
+ close(fd);
+ fd = -1;
}
+ *stp = st;
return fd;
}