db07609875
segfaults from bnc#710486 due to unchecked usage of return value of open_ctree() [fixed compilation warnings] - pull upstream, replace existing patches, spec update - update 'restore' utility - lzo support - tools may now take earlies superblock when opening the fs - other fixes - pull integration-20111030 branch - mkfs: force mkfs if desired - other fixes - add btrfs-dump-super to mkinitrd - other fixes - skip non-existent devices or without media - documentation updates - scrubbing single device - graceful error handling when opening fs fails - updated mkinitrd script to scan devices before mount (bnc#727383) OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=115
86 lines
2.1 KiB
Diff
86 lines
2.1 KiB
Diff
From 6ca37050db7e94257559da2b8e8009c2347ed798 Mon Sep 17 00:00:00 2001
|
|
From: Chris Mason <chris.mason@oracle.com>
|
|
Date: Thu, 27 Oct 2011 16:23:14 -0400
|
|
Subject: [PATCH 16/35] btrfs-progs: fixup is_mounted checks
|
|
|
|
/proc/mounts contains device names that don't exist,
|
|
we end up erroring out because we're not able to stat
|
|
the device (that doesn't exist).
|
|
|
|
Fix this by allowing the mkfs when the target device doesn't exist.
|
|
|
|
Signed-off-by: Chris Mason <chris.mason@oracle.com>
|
|
---
|
|
utils.c | 34 +++++++++++++++++++---------------
|
|
1 files changed, 19 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/utils.c b/utils.c
|
|
index 1c27e14..6c96548 100644
|
|
--- a/utils.c
|
|
+++ b/utils.c
|
|
@@ -674,11 +674,11 @@ int is_same_blk_file(const char* a, const char* b)
|
|
char real_a[PATH_MAX];
|
|
char real_b[PATH_MAX];
|
|
|
|
- if(!realpath(a, real_a) ||
|
|
- !realpath(b, real_b))
|
|
- {
|
|
- return -errno;
|
|
- }
|
|
+ if(!realpath(a, real_a))
|
|
+ strcpy(real_a, a);
|
|
+
|
|
+ if (!realpath(b, real_b))
|
|
+ strcpy(real_b, b);
|
|
|
|
/* Identical path? */
|
|
if(strcmp(real_a, real_b) == 0)
|
|
@@ -719,8 +719,8 @@ int is_same_loop_file(const char* a, const char* b)
|
|
{
|
|
char res_a[PATH_MAX];
|
|
char res_b[PATH_MAX];
|
|
- const char* final_a;
|
|
- const char* final_b;
|
|
+ const char* final_a = NULL;
|
|
+ const char* final_b = NULL;
|
|
int ret;
|
|
|
|
/* Resolve a if it is a loop device */
|
|
@@ -729,10 +729,12 @@ int is_same_loop_file(const char* a, const char* b)
|
|
return 0;
|
|
return ret;
|
|
} else if (ret) {
|
|
- if ((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
|
|
- return ret;
|
|
-
|
|
- final_a = res_a;
|
|
+ if ((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0) {
|
|
+ if (errno != EPERM)
|
|
+ return ret;
|
|
+ }
|
|
+ else
|
|
+ final_a = res_a;
|
|
} else {
|
|
final_a = a;
|
|
}
|
|
@@ -743,10 +745,12 @@ int is_same_loop_file(const char* a, const char* b)
|
|
return 0;
|
|
return ret;
|
|
} else if (ret) {
|
|
- if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0)
|
|
- return ret;
|
|
-
|
|
- final_b = res_b;
|
|
+ if ((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0) {
|
|
+ if (errno != EPERM)
|
|
+ return ret;
|
|
+ }
|
|
+ else
|
|
+ final_b = res_b;
|
|
} else {
|
|
final_b = b;
|
|
}
|
|
--
|
|
1.7.6.233.gd79bc
|
|
|