Commit Graph

913 Commits

Author SHA1 Message Date
Arne Redlich 17eff2d8d9 scsi-lowlevel: remove scsi_read12_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:37:05 +01:00
Arne Redlich f955449ecc scsi-lowlevel: remove scsi_read10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:35:37 +01:00
Arne Redlich d95e811ccf scsi-lowlevel: remove scsi_read6_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:34:08 +01:00
Arne Redlich 76aa2693c4 scsi-lowlevel: remove scsi_reportluns_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:31:11 +01:00
Ronnie Sahlberg 3ccc2f2834 TESTS: Update the VERIFY10/12/16 tests for BYTCHK==0 2012-11-18 10:10:04 -08:00
Ronnie Sahlberg f9767e729a VERIFY10/12/16 If BYTCHK is false we dont need to transfer any blocks to the target
If BYTCHK is false the target will perform a medium check of the indicated
LBAs only and not compare with anything out of the DATA-OUT buffers.
As such we dont need to/should not transfer any DAT-OUT to the target.
2012-11-18 09:46:51 -08:00
Arne Redlich 44cb5d60c5 iscsi.h: include <sys/types.h> as iscsi_data gained a size_t member
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 00:36:28 +01:00
Ronnie Sahlberg e661c22875 Merge pull request #36 from plieven/master
Merge of my patches as discussed
2012-11-12 16:44:18 -08:00
Peter Lieven b1374b42ed Rename scsi-command.c to iscsi-command.c 2012-11-12 16:12:29 +01:00
Peter Lieven 8cb369b87f Merge remote-tracking branch 'upstream-git/master'
Conflicts:
	include/iscsi-private.h
	include/iscsi.h
	lib/connect.c
	lib/init.c
	lib/scsi-lowlevel.c
2012-11-12 16:02:57 +01:00
Peter Lieven 5e1d011270 SCSI-LOWLEVEL revert changes to scsi-lowlevel
The memory tracking code reports memory allocated by iscsi_allocate_pdu_with_itt_flags_size() as lost.
This memory is allocated by the iscsi part of libiscsi, but later freed by the lowlevel scsi part. We
will fix this later by introducing an iscsi_task object.
2012-11-12 15:43:29 +01:00
Ronnie Sahlberg 736e175e83 Build with -Werror 2012-11-11 10:15:52 -08:00
Ronnie Sahlberg 5a95010b59 Fix some compiler warnings 2012-11-11 10:12:39 -08:00
Ronnie Sahlberg 9eb26a368d Fix compiler warnings related to 'const' 2012-11-11 10:03:45 -08:00
Ronnie Sahlberg a5b8224f4e Dont include iscsi headers from the scsi implementation in scsi-lowlevel.c 2012-11-11 09:49:49 -08:00
Ronnie Sahlberg 3b05e9996f Move cancel_task and cancel_all_tasks from scsi-lowlevel.c to scsi-command.c
These two functions belong in the iscsi layer, not the scsi layer so move them
out from scsi-lowlevel.c so that we can start turning scsi-lowlevel.c to a pure
scsi layer and remove all dependencies to iscsi from it.
2012-11-11 09:44:11 -08:00
Ronnie Sahlberg 49af416f47 When we cancel a scsi task we don't need to unlink the in_buffers
We dont need to unlink the in-buffers when cancelling a scsi task
since the whole task structure will go away shortly anyway and all
entries in the link will be automatically freed when the task is freed.
2012-11-11 09:35:34 -08:00
Peter Lieven 5722ad7e98 LOGIN change dynamic string allocations to statics 2012-11-11 08:42:06 -08:00
Peter Lieven 8512f19911 ISCSI-READCAPACITY16 fix missing free of scsi_task 2012-11-11 08:32:05 -08:00
Peter Lieven 864a4d60a0 LD_ISCSI invalidate get_lba_status cache on write 2012-11-11 08:17:27 -08:00
Peter Lieven f331556d65 LD_ISCSI add pwrite and dlsym it at init 2012-11-11 08:15:51 -08:00
Peter Lieven bd04f4bfa6 LD_ISCSI add pwite 2012-11-11 08:15:26 -08:00
Peter Lieven 6884b6eb75 LD_ISCSI add write
the write command is limited in the sense that file offset and
count bytes must be multiple of the targets blocksize. for most
copy/dd etc. operations this is sufficient to work.
2012-11-11 08:14:38 -08:00
Peter Lieven bf758c7833 LD_ISCSI add pread 2012-11-11 08:14:10 -08:00
Peter Lieven 59860df16a LD_ISCSI add lseek 2012-11-11 08:13:47 -08:00
Peter Lieven 01cd2ee42b LD_ISCSI fix segfault on reconnect
iscsi_reconnect calls dup2 which is intercepted in ld_iscsi. Fix this by
calling the real dup2 in this case.
2012-11-11 08:13:03 -08:00
Ronnie Sahlberg 4de36794f2 Make scsi_allocated_memory private to scsi-lowlevel and remove the ptr pointer
Change the list-head structure for in-task scsi memory allocations to
be private to scsi-lowlevel since is is never accessed from anyehwere else and
it is private to this function.
Remove the pointer to the user data in the list head and replace it with a zero length buffer at the end of the header.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-11-11 08:07:26 -08:00
Peter Lieven a0b9080c6c SCSI half mallocs in scsi_malloc 2012-11-11 08:07:13 -08:00
Peter Lieven 144026a7bd RECONNECT allow a consecutive reconnect only every 5 seconds
In case there is an error condition e.g. out of memory. We are heavily
disconnecting and reconnecting without any limit. This patch
adds a 5 seconds period that has to go by between 2 reconnects.
2012-11-08 16:56:44 +01:00
Ronnie Sahlberg 50e7c682bb Add a logging subsystem and change all DPRINTF to ISCSI_LOG
Add a mechanism where we can set a logging subsystem that libiscsi can use.
Create an example 'log to stderr' that utilities can use for convenience.
2012-11-07 06:34:38 -08:00
Peter Lieven a97b51bbe5 Revert "DEBUG add function to set debug fd"
We will have a completely different debugging framework soon.

This reverts commit ec46d6fa43.
2012-11-07 06:45:54 +01:00
Ronnie Sahlberg c10ae3ae3e New version 1.7.0
- Lots of additional tests.
- ld_iscsi updates and bugfixes.
- Fix a protocol bug where we might send > FirstBurstLength amount of data
  as unsolicited data.
- Tcp keepalive improvements.
- Debugging framework.
- Add support for redirection.
- Fix reconnect bug where we would incorrectly re-queue DATA-OUT PDUs after
  reconnect.
- Add a new iscsi-readcapacity16 command.
- Squelch a huge number of compiler warnings.
2012-11-06 18:40:30 -08:00
Peter Lieven ec46d6fa43 DEBUG add function to set debug fd
DPRINTF was blindly sending all debug output to fd 2 (stderr).
The new function iscsi_set_debug_fd() will set the debug fd.
In general debugging is completely disabled by default.
2012-11-06 16:07:43 +01:00
Peter Lieven 3e57a612db SOCKET add more skill to interface binding
If a process opens more than once connection the interfaces are assigned
round-robin from the available ones. However, different processes will
uses a random interface of as starting point. This patch will also
make the redirect case handled correctly.
2012-11-06 15:47:30 +01:00
Ronnie Sahlberg d81bcd7b38 Dont print to stderr from _set_error if iscsi is NULL
If iscsi is NULL then just do nothing and dont log to stderr.
Our caller might have closed stderr or worse, re-used fd 2 for something else.
2012-11-06 06:20:11 -08:00
Peter Lieven bde85a4b57 INIT allow iscsi_context = NULL in iscsi_set_error()
qemu-kvm calls iscsi_parse_url_full() with iscsi = NULL.
In case there is an invalid URL specified qemu-kvm segfaults when
it tries to set iscsi->error_string.

I tried to patch this in qemu-kvm, but the initiator_name is dirived
from the target name so this seemed to be the easier approach.
2012-11-06 06:13:17 -08:00
Peter Lieven f00cd04810 INIT call srand() once at iscsi_create_context()
currently the rng is not seeded at all which makes the isid not really random
at all.
2012-11-06 15:01:34 +01:00
Peter Lieven 6cad82532a SOCKET add option to bind to connection to interface(s) 2012-11-06 14:53:55 +01:00
Peter Lieven 0d8819e68f INIT allow iscsi_context = NULL in iscsi_set_error()
qemu-kvm calls iscsi_parse_url_full() with iscsi = NULL.
In case there is an invalid URL specified qemu-kvm segfaults when
it tries to set iscsi->error_string.

I tried to patch this in qemu-kvm, but the initiator_name is dirived
from the target name so this seemed to be the easier approach.
2012-11-06 08:53:38 +01:00
Peter Lieven 1ba60282bf LD_ISCSI invalidate get_lba_status cache on write 2012-11-05 21:23:30 +01:00
Peter Lieven 57ec16023e LOGIN change dynamic string allocations to statics 2012-11-05 15:33:12 +01:00
Peter Lieven e6553c2ef8 MEMORY account reallocs 2012-11-05 15:20:15 +01:00
Peter Lieven 65cd38e8ff PDU further optimize iscsi_add_data()
This patch further improves add data and esepcially preassigns
the right amount of memory where the amount is preknown
2012-11-05 15:13:50 +01:00
Ronnie Sahlberg 6c2c583af1 Merge pull request #34 from aredlich/master
Fixes for libiscsi compiler warnings
2012-11-04 15:40:47 -08:00
Peter Lieven b5183d5e30 LD_ISCSI add pwrite and dlsym it at init 2012-11-03 18:15:05 +01:00
Peter Lieven e1bb8e1ed1 LD_ISCSI add pwite 2012-11-03 18:12:39 +01:00
Peter Lieven 0639c7e9ab LD_ISCSI add write
the write command is limited in the sense that file offset and
count bytes must be multiple of the targets blocksize. for most
copy/dd etc. operations this is sufficient to work.
2012-11-03 18:08:12 +01:00
Peter Lieven 2e413a3c9f LD_ISCSI add pread 2012-11-03 17:48:31 +01:00
Peter Lieven d2894e4634 LD_ISCSI add lseek 2012-11-03 17:36:29 +01:00
Peter Lieven 0bf8b38808 LD_ISCSI fix segfault on reconnect
iscsi_reconnect calls dup2 which is intercepted in ld_iscsi. Fix this by
calling the real dup2 in this case.
2012-11-03 11:09:20 +01:00