[PATCH 3/3] tgt-admin: avoid in-use and backing_store existence tests for rbd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Careful with precedence rules in these complex boolean expressions.

Signed-off-by: Dan Mick <dan.mick@xxxxxxxxxxx>
---
 scripts/tgt-admin |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index fdb8232..8dfc01d 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -479,14 +479,16 @@ sub add_backing_direct {
 	my $data_key_ref = $_[2];
 	my $direct_store = $_[3];
 	my $driver = $$target_options_ref{"driver"};
+	my $bstype = $$target_options_ref{"bs-type"};
 
 	# Is the device in use?
 	my $can_alloc = 1;
-	if ($force != 1 && $$target_options_ref{'allow-in-use'} ne "yes") {
+	if ($bstype !~ "rbd" && $force != 1 && $$target_options_ref{'allow-in-use'} ne "yes") {
 		$can_alloc = check_device($backing_store,$data_key_ref);
 	}
 
-	if (-e $backing_store && ! -d $backing_store && $can_alloc == 1) {
+	if ($can_alloc == 1 &&
+	   ($bstype =~ "rbd" || (-e $backing_store && ! -d $backing_store))) {
 		my @exec_commands;
 		my $device_type;
 		my $bs_type;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux