tgt 1.0.49

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

This patch implements iSCSI multipath support in sheepdog backing
store driver. Below is a brief description of the feature:

The main problem of enabling iSCSI multipath for sheepdog's VDI is
keeping coherence of tgtd's internal inode data structure. Assume tgt
A and B have logical units which point same sheepdog VDI. After
initialization of the logical units, A and B have copies of inode
object in their address space (let's X denote this object). When an
initiator sends write request to A and the request causes COW, A
creates a new object and updates the inode object X (let's X' denote
the updated one).

After the update by A, A can die with hardware faults. In such a case,
the initiator detects a connection error and switch its target to B if
iSCSI multipath is configured correctly. But the problem can arise at
this point. Because B doesn't know the update caused by A and its
internal inode object is still X, not X'. B creates requests based on
X, so it can read obsolete data which is already hidden by X' or
update X' in wrong manner.

For solving the above problem, sheepdog implements inode object
coherence protocol which mocks MSI protocol of shared memory multicore
processors. With this mechanism sheepdog can prevent requests which
are based on obsolete inode objects. This patch let sheepdog driver of
tgtd adopt the coherence protocol.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: protocol update for revivng backward compatibility

This update is just for updating protocol of sheepdog. Recent
discussion in the sheepdog community requires it.

Singed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
MMC: add a dedicated backend for MMC so that supported-opcode map works

MMC has been broken for a while since some of the vital opcodes
(GET_CONFIGURATION) and friends are not in the supported opcode
whitelist in bs_rdwr.c.
The real problem is that we have a bs_rdwr.c backend for SBC and we
piggyback on this SBC backend also for the MMC emulation.

Add defines for the missing MMC opcodes and create a new backend
dedicated for MMC that has the proper whitelist for MMC opcodes.
This new backend is actually part of bs_rdwr.c and shares all the
code with the SBC based backend.
However the new MMC backend will have a different name "mmc" to indicate
it is for the MMC emulation and it comes with a supported opcode
whitelist that is appropriate for MMC devices.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
DOCS: add an example dvd jukebox script

Add an example script that can be used to automatically set up a DVD jukebox
with a dvd drive and a medium changer that will export all your ISO images.

Use the mtx command to operate which media should be loaded.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.50

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
SMC: add a new volume_tag parameter to storage slots

SMC barcodes in TGTD are limited to just 10 characters while T10
VolumeTags for smc storage slots allow up to 32 bytes.
Introduce a new argument when populating slots for specifying a volume tag
of up to 32 characters. If no volume tag is specified we fallback to use the
barcode as the volume tag.

Leave the current barcode as is, limited to 10 characters to not break
compatibility with scripts that might use SMC devices.

Update the dvdjukebox example script to use volume tag. This allows us to
hand a much more useful name back to the MTX tool than the barcode.
(10 characters is pretty restrictive as an ASCII text string. The full
ISO image file name is most likely much more meaningful to a human.)

Update the tgtadm manpage and show the new volume_tag argument.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
SMC: add a smc backend template with an opcode whitelist

SMC is not working properly since we do not yet initialize a proper
SMC backend to tell it which opcodes are valid and which are not.
With this change SMC works again and we can create a jukebox that
mtx can communicate with correctly.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: refresh invalidated inode in update_inode() path

This patch also adds a string representation of new error code
SD_RES_INODE_INVALIDATED.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: set flag for indicating requests are from tgt

It is required for iSCSI multipath with sheepdog.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sheepdog: change a method for detecting invalidation of inode

Current method of detecting invalidation of inode can produce bunch of
error messages if a first object of VDI doesn't exist. This patch
updates the method: reading first one byte of inode object. It can
reduce needless and confusing error messages.

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

Current sheepdog driver reloads inode when in both cases of snapshot
and invalidateion with iSCSI multipath. In the first case, reloading
whole inode isn't required. This patch reduces the overhead produced
by whole reloading in the case of snapshot.

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

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bs_sheepdog.c: fix a compiler warning due to an unused label

This gets rid of the following gcc warning in sd_open function by
removing the unused label 'retry':

 bs_sheepdog.c: In function 'sd_open':
 bs_sheepdog.c:1199:1: warning: label 'retry' defined but not used [-Wunused-label]
  retry:
  ^

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