[stgt] make initiators "rescan" the device?

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Thu Oct 30 08:37:58 CET 2008


On Thu, 30 Oct 2008 07:55:12 +0100
Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> FUJITA Tomonori schrieb:
> > On Wed, 29 Oct 2008 12:26:58 +0100
> > Tomasz Chmielewski <mangoo at wpkg.org> wrote:
> > 
> >> Sometimes, I need to resize the device on the target.
> >>
> >> Technically, I do this as follows:
> >>
> >> lvextend -L+5G /dev/san14/blah1
> >> tgt-admin --update tid=20 -v -f
> > 
> > What does exactly 'tgt-admin --update tid=20 -v -f' do? Please explain
> > what tgtadm operations are performed. Please do so at all times (hint:
> > I don't understand how tgt-admin works).
> 
> Basically, it disconnects all initiators, removes the target, and adds 
> it again. Removing the lun and adding it again would be enough, as you 
> also write below.

OK, I thought that you wants to resize a device without disconnecting
initiators or removing the target.


> > Well, unless you delete a logical unit and add it again, tgtd doesn't
> > know the new size. So probably, we need to a new interface to notify
> > tgtd of the change.
> > 
> > 
> >> However, the initiators won't see the change unless we "rescan" the 
> >> device, i.e.:
> >>
> >> echo 1 > /sys/block/sdah/device/rescan
> > 
> > Unless you use 2.6.28-rc kernel, it doesn't work, I think.
> 
> It works for me with 2.6.18 kernels.

Sorry, I should have been more specific. Yes, the above operation
issues commands like READ CAPACITY so it works from the perspective of
SCSI but well you might want something more with resizing:

http://marc.info/?l=linux-scsi&m=122005161211449&w=2


> >> This is a boring thing to do when we have more initiators connected to 
> >> that target.
> >> Also, the initiators will likely have a different device used for that 
> >> target (/sys/block/<DEVICE>/device/rescan), making the thing even more 
> >> boring.
> >>
> >>
> >> Is it possible to send a reset/rescan to all initiators connected to a 
> >> given target, which would trigger the initiator to rescan the device 
> >> (and its size)?
> > 
> > A scsi device can notify initiators of such event via UA (unit
> > attention), google "CAPACITY DATA HAS CHANGED". tgt has the mechanism
> > to handle UA so it's easy to support it. However, on the initiator
> > side, Linux doesn't detect such event automatically.
> 
> I see.
> So let's just hope Linux will detect such events one day ;)
> 
> 
> -- 
> Tomasz Chmielewski
> http://wpkg.org
> --
> 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