tgtd: refresh ready fds of event loop after event deletion

Current main event loop (event_loop()) of tgtd has a possibility of
segmentation fault. The problem is caused by the below sequence:

1. Event A, B are ready so epoll_wait(2) returns.
2. The handler of the event A is called. In the event handler, the
   event B is deleted with tgt_event_del()
3. event_loop() tries to call the handler of the event B. It causes
   segfault because the event struct is already removed and freed.

For avoid this problem, this patch adds a new global variable
event_need_refresh. If the value of this variable is 1, event_loop()
calls epoll_wait(2) again for refreshing ready fd list. This patch
also lets tgt_event_del() to turn on the flag in its tail.

For example, we can produce segfault of tgtd under heavy load. Below
is a backtrace obtained from the core file:
 (gdb) bt
 #0  0x0000000000000000 in ?? ()
 #1  0x0000000000411419 in event_loop () at tgtd.c:414
 #2  0x0000000000411b65 in main (argc=<value optimized out>, argv=<value optimized out>) at tgtd.c:591

To be honest, I still don't find an event handler which calls
tgt_event_del() for other fds. But with this modification, the above
segfault is avoided. The change seems to be effective.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgtd: let event_need_refresh be a static variable

The variable don't have to be visible from other source files.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgtd: fix internal error of __inaccount_bind()

When trying to bind 32 accounts to the same target, tgtadm outputs
"unknown error" and exits returing status code 22 (EINVAL).

This is because __inaccount_bind() function of tgtd does not increment
target->account.nr_inaccount when it doubles maximum number of
accounts for the target, and therefore it tries to allocate an aid
slot on target->account.in_aids[] array even though no free aid slot
is available there.

This fixes the bug.

Reported-by: Satoshi Yoshida <yoshida.satoshi@po.ntts.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
iscsi: Move two messages to be logged as debug and not as errors

Move two messages which are printed when connections are close from error
to debug level.

Without this change, a message currently gets logged every time an automatic
discovery process runs on the initiator node when using the discovery database.
When using multiple Control Ports, there are a lot of messages getting logged.
These essentially flood the /var/log/messages file on the initiator.

Signed-off-by: Dennis Cullison <Dennis.Cullison@Teradata.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>