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

Dan Mick dan.mick at inktank.com
Tue Oct 15 06:50:01 CEST 2013


resubmitted, with much better testing.

On 10/14/2013 01:14 PM, Dan Mick wrote:
>
>
> On 10/14/2013 07:43 AM, FUJITA Tomonori wrote:
>> On Fri, 11 Oct 2013 15:59:01 -0700
>> Dan Mick <dan.mick at inktank.com> wrote:
>>
>>> Signed-off-by: Dan Mick <dan.mick at inktank.com>
>>> ---
>>>   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 at vger.kernel.org
>>> 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 at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list