Re: tgtadm/tgtd management issue: buffer size truncated sometimes

FUJITA Tomonori <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <20140124.192139.1568838937885768572.fujita.tomonori@lab.ntt.co.jp>
On Fri, 24 Jan 2014 12:51:13 +0400
Artyom Pervukhin <[email protected]> wrote:

> Can you please specify what linux distribution and libraries version
> are you using?

Debian squeeze amd64.

> I¢m able to reproduce this bug on current tgt codebase (17222f2b00d29368da214e2d59cbc9e00f53606b) built on  Debian wheezy amd64. Bug frequency increases with number of targets:
> 
> 
> 1000 targets (all loaded, as `tgtadm -C 0 --op show --mode target --tid 1000` shows target settings):
> 
> root@sandbox:~ # for i in $(seq 100) ; do tgtadm -C 0 --op show --mode target | grep -c ^Target ; done | sort | uniq -c                                                     
>     100 978
> root@sandbox:~ # for i in $(seq 100) ; do tgtadm -C 0 --op show --mode target | wc -c ; done | sort | uniq -c                                                              
>     100 1033140

I can reproduce the same problem with 1000.

root@rose:~# for i in $(seq 100); do tgtadm --op show --mode target|grep -c ^Target;done|sort|uniq -c
     97 1000
      1 972
      1 995
      1 997

Strangely, looks like I can get the correct result without 'grep':

root@rose:~# for i in $(seq 100); do tgtadm --op show --mode target|python -c "import sys; print len([line for line in sys.stdin if \"Target\" in line])";done|sort|uniq -c
    100 1000
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.