iser: fix a warning about container_of being redefined

container_of is being defined in list.h and verbs.h differently.
To keep tgtd toe use the container_of from list.h as today, Instead of
wrapping ifndef which exists in verbs.h I moved the inclusion of verbs
to after list.h

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Update debian build to use local docbook-xsl for generating docs

Building debian package procedure generates a lot of errors generating
the docs and takes forever to finish.
This patch will change the procedure to use local available docbook-xsl.
Added build dependency for docbook-xsl and updated debian build script to
set it as build dependency.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fix race on thread shutdown causing deadlock

This patch and the next are somewhat a revert of 318e9f2, but the previous
fix didn't quite close the race. This only happens when we create threads
for a backstore that turns out to be invalid, which we then tear down.

See https://bugzilla.redhat.com/show_bug.cgi?id=848585 .

This is occurring because there's still a window where a thread misses
seeing info->stop == 1 but is not yet in cond_wait so it misses the
broadcast:

thread_close:              thread_worker_fn:
                           info->stop is seen as 0
info->stop = 1
pthread_cond_broadcast     -- misses broadcast
                           pthread_cond_wait
pthread_join (hangs)

I believe the solution is to go back to using pthread_cancel. We can call
it before pthread_cond_wait is called (or after) and it will do the right
thing: pop out and exit. The only tricky bit is we need to use the
pthread_cleanup_push mechanism to properly release info->pending_lock.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Remove startup_lock

The purpose of the startup lock was to hold threads at the startup_lock
so if a thread creation fails, it's still possible to have them
end themselves by looking at info->stop. Since we are back to using
pthread_cancel instead of info->stop, we don't need this any more.
The only wrinkle is we need to only send pthread_cancels to
successfully-created threads, so now check this in the destroy_threads
reverse-loop.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Replace if()/goto with while()

Is equivalent and nicer-looking.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Remove unneeded pthread_cond_broadcast

Previous patchset neglected to remove a now unneeded call.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.47

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fix tgtd.spec to build on SLES

The docbook package name is different between RedHat and SLES.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
added support for bsoflags parameter

This patch will allow one to use bsoflags with tgt-admin.

Signed-off-by: Cédric Milesi <cedric.milesi@hp.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
systemd notification support

tgtd may take some time to initialize before accepting management
commands. Since management commands are used to bring the targets up
during service startup, we have to make sure that tgtd is responsive
before proceeding. To this end, we add a call to sd_notify(3) right
before entering the event loop to signal systemd (if applicable) that
the main process is ready.

Systemd support with the relevant includes and linker flags is optional,
controlled by the SD_NOTIFY make flag.

Signed-off-by: Apollon Oikonomopoulos <apoikos@debian.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
iser: make membuf size configurable

membuf size is the max size of one rdma buffer used.
The default is still 512 as was but a user can now change it
to 1024 for example to be able to use bigger block sizes.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
iser: add portals support

This adds IPv6 support for iser.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.48

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: turn on cache flag of write request

tgtd doesn't affect semantics of caching, so we can always turn on
cache feature of sheepdog layer.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: update layout of inode object header

This change doesn't affect behavior of sheepdog driver. Just for
documentation purpose.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: add documentation

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bs_ssc: remove unused variables

The variables, transfer_length and residue are never used in the
function tape_rdwr_request()

Signed-off-by: Ruoyu <liangry@ucweb.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bs_rbd: fix error assignment in if condition

The statement

if ((x == f()) < 0) {}

is strange. I think it should be

if ((x = f()) < 0) {}

For the reasone of coding style, I modify it as

x = f();
if (x < 0) {}

Signed-off-by: Ruoyu <liangry@ucweb.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bs_rdb: Add virsecretuuid && cephx_key

Allow passing either a libvirt secret UUID, or a cephx_key to --bsopts. Options are
conflicting, so error if both options given. This allows one to do this:

--bsopts="conf=/etc/ceph/ceph.conf;id=cephx_user;virsecretuuid=$MY_LIBVIRT_SECRET_UUID"
-OR-
--bsopts="conf=/etc/ceph/ceph.conf;id=cephx_user;cephx_key=$MY_KEY"

Signed-off-by: Scott Sullivan <ssullivan@liquidweb.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.49

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>