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

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

 





On 10/14/2013 07:43 AM, FUJITA Tomonori wrote:
On Fri, 11 Oct 2013 15:59:01 -0700
Dan Mick <dan.mick@xxxxxxxxxxx> wrote:

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

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index d374172..55b7a55 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -479,14 +479,15 @@ 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)) {

This affects other bstypes?

I can see where the order of operations might be incorrect.  Let me
think a little harder on this one.


  		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
--
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