- 13 Dec, 2012 2 commits
-
-
Chris Boot authored
If the TPG memory is allocated successfully, but we fail further along in the function, a dangling pointer to freed memory is left in the TPort structure. This is mostly harmless, but does prevent re-trying the operation without first removing the TPort altogether. Reported-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Chris Boot <bootc@bootc.net> Cc: Andy Grover <agrover@redhat.com> Cc: Nicholas A. Bellinger <nab@linux-iscsi.org> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Chris Boot authored
There is no need to memcpy() a 32-bit integer. The data pointer is guaranteed to be quadlet aligned by the FireWire stack so we can replace the memcpy() with an assignment. Thanks to Stefan Richter. Signed-off-by: Chris Boot <bootc@bootc.net> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: Andy Grover <agrover@redhat.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 08 Dec, 2012 1 commit
-
-
Sebastian Andrzej Siewior authored
The kmalloc() + strlen() + memcpy() block is what kstrdup() does as well. While here I also removed the "to NULL assignment" of pointers which are fed to kfree or thrown away anyway. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 05 Dec, 2012 3 commits
-
-
Sebastian Andrzej Siewior authored
Those two functions are almost identical so merge them. Noticed this while fixing the highmem in both cases. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Sebastian Andrzej Siewior authored
This patch changes vectored file I/O to use kmap + kunmap when mapping incoming SGL memory -> struct iovec in order to properly support 32-bit highmem configurations. This is because an extra bounce buffer may be required when processing scatterlist pages allocated with GFP_KERNEL. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch adds [dev,lun]_link_magic value assignment + checks within generic target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure destination config_item *target_item sent from configfs_symlink() -> config_item_operations->allow_link() is the underlying se_device->dev_group and se_lun->lun_group that we expect to symlink. Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 28 Nov, 2012 14 commits
-
-
Nicholas Bellinger authored
This patch converts the TMR path in srpt_handle_tsk_mgmt() to use target_submit_tmr() with TARGET_SCF_ACK_KREF flag usage. v2: Drop ununused res in target_submit_tmr (Fengguang.Wu) Cc: Christoph Hellwig <hch@lst.de> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Roland Dreier <roland@kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch converts the main srpt_handle_cmd() I/O path to use modern target_submit_cmd() with TARGET_SCF_ACK_KREF flag usage. This includes dropping the original internal ioctx->kref + srpt_put_send_ioctx() usage in favor of target_put_sess_cmd() w/ se_cmd_t->cmd_kref within ib_srpt response callbacks. It also updates srpt_abort_cmd() to call target_put_sess_cmd() for completion of aborted commands, and adds target_wait_for_sess_cmds() into srpt_release_channel_work() to allow outstanding I/O to complete during session shutdown. Also, go ahead and update srpt_handle_tsk_mgmt() to make the remaining transport_init_se_cmd() to setup the ioctx->cmd with se_tmr_req. Cc: Christoph Hellwig <hch@lst.de> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Roland Dreier <roland@kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
We already expect TFO->get_blocks() to return sector_t for zero value case when doing WRITE_SAME to the end of the backend device, so go ahead and return sector_t from spc_get_write_same_sectors() to handle this case properly. Also, update the single iblock_execute_write_same() caller of this code. Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Sebastian Andrzej Siewior authored
All elements are assigned even the NULL member at the end so there is no reason to allocate zeroed memory. (nab: Fix up minor apply breakage in for-next) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Sebastian Andrzej Siewior authored
Only slots 0-5 are used so 6 slots should be enough. I don't see anyone writting anything else than NULL into ->default_groups[5] so a "late" initialisation should not happen here. (nab: Fix up minor apply breakage in for-next) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Sebastian Andrzej Siewior authored
default_groups is defined as struct config_group **default_groups so we don't need to allocate a whole struct but only enough space for a pointer that points there. (nab: Fix up minor apply breakage in for-next) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Dan Carpenter authored
We recently changed this to return positive subsystem error codes so the error handling needs to be updated. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Wei Yongjun authored
The function iscsit_build_conn_drop_async_message() is called from iscsit_close_connection() with spin lock 'sess->conn_lock' held, so we should use GFP_ATOMIC instead of GFP_KERNEL. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Sachin Kamat authored
kfree on null pointer is a no-op. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
Go ahead and forward declare the handful of helper functions required for bio submission code in order to avoid the extra function prototypes. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
-
Roland Dreier authored
No need to have a goto where a return is clearer. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
-
Steve Hodgson authored
Search through the list of pending commands on the session list to find the command the initiator is actually aborting, so that we can pass the correct LUN to the core TMR handling code. (nab: Allow abort requests to work to LUN=0 with mainline target code) Signed-off-by: Steve Hodgson <steve@purestorage.com> Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
-
Nicholas Bellinger authored
v2: Use correct target_core_stat.c 2006 copyright year v3: Drop extra unnessary legal verbage from header (hch) Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 15 Nov, 2012 3 commits
-
-
Nicholas Bellinger authored
This patch adds support for emulation of WRITE_SAME w/ UNMAP=0 within iblock_execute_write_same() backend code. The emulation uses a bio_add_page() call for each sector, and by default enforces a limit of max_write_same_len=0xFFFF (65536) sectors following what scsi_debug reports per default for MAXIMUM WRITE SAME LENGTH. It also sets max_write_same_len to the operational default at setup -> iblock_configure_device() time. (hch: Move unmap logic into iblock_execute_write_same_unmap + add check for single sector SGLs in iblock_execute_write_same) (mkp: Update comment for 0xFFFF magic constant) (nab: drop left-over max_write_same_len check in iblock_execute_write_same) Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch adds a new max_write_same_len device attribute for use with WRITE_SAME w/ UNMAP=0 backend emulation. This can be useful for lowering the default backend value (IBLOCK uses 0xFFFF). Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated WRITE_SAME w/ UNMAP=0 cases. (Robert: Move max_write_same_len check in sbc_setup_write_same() to check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases) Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Robert Elliott <Elliott@hp.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch adds a new sbc_ops->execute_write_same_unmap() caller for use with WRITE_SAME w/ UNMAP=1, and performs the ->execute_cmd() setup based this bit within sbc_setup_write_same() code. Also, makes the changes in sbc_parse_cdb() to handle a sense_reason_t return from sbc_setup_write_same() on error. Reported-by: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 08 Nov, 2012 7 commits
-
-
Nicholas Bellinger authored
As reported by Fengguang Wu + 0 day build team, the sense_reason_t conversion in for-next did not catch the recent sbc_emulate_noop() addition in mainline, producing the following build warning in auto-next: drivers/target/target_core_sbc.c: In function ‘sbc_parse_cdb’: drivers/target/target_core_sbc.c:555: warning: assignment from incompatible pointer type Go ahead and remove duplicate sbc_emulate_verify(), and change VERIFY to use sbc_emulate_noop() as well. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Kees Cook authored
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it from any "depends on" lines in Kconfigs. CC: Chris Boot <bootc@bootc.net> CC: "Nicholas A. Bellinger" <nab@linux-iscsi.org> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
There are some cases, for example when the initiator sends an out-of-bounds ErrorRecoveryLevel value, where the iSCSI target terminates the connection without sending back any error. Audit the login path and add appropriate iscsit_tx_login_rsp() calls to make sure this doesn't happen. Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Steve Hodgson authored
This patch fixes a bug in the hanlding of initiator provided ExpStatSN and individual iscsi_cmd->stat_sn comparision during iscsi_conn->stat_sn wrap-around within iscsit_ack_from_expstatsn() code. This bug would manifest itself as iscsi_cmd descriptors not being Acked by a lower ExpStatSn, causing them to be leaked until an iSCSI connection or session reinstatement event occurs to release all commands. Also fix up two other uses of incorrect CmdSN SNA comparison to use wrapper usage from include/scsi/iscsi_proto.h. Signed-off-by: Steve Hodgson <steve@purestorage.com> Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
We need to disable BHs when taking sess_idr_lock because the iscsit_handle_time2retain_timeout() timer function takes se_tpg->session_lock, and iscsit_close_session() nests sess_idr_lock inside se_tpg->session_lock. So if the timer can run inside sess_idr_lock, we have a potential AB-BA deadlock. Fix this by disabling BHs when taking sess_idr_lock. This was found because of a lockdep warning, but it looks like a real (if highly theoretical) deadlock. In any case avoiding lockdep spew so that we can find other issues is a worthy cause. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
Fix a regression bug in core_scsi3_emulate_pro_release() where should still be getting released via core_scsi3_put_pr_reg() during No persistent reservation, with returing GOOD status. Use goto statement here to follow converted code from hch. Cc: Christoph Hellwig <hch@lst.de> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch fixes a possible case in transport_generic_new_cmd() where a failure from TFO->write_pending() from a fabric module return something other than -EAGAIN or -ENOMEM would cause a failed WRITE to silently succeed. Go ahead and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE for this special case instead of only just making noise with WARN_ON(). (v2: Fix incorrect exception return for all cases) Cc: Christoph Hellwig <hch@lst.de> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
- 07 Nov, 2012 10 commits
-
-
Nicholas Bellinger authored
Fix a bug introduced with patch "target: pass sense_reason as a return value" in for-3.8 code where only target port groups with TPGS_EXPLICT_ALUA set need to be allowed to perform explictly ALUA. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Christoph Hellwig authored
Pass the sense reason as an explicit return value from the I/O submission path instead of storing it in struct se_cmd and using negative return values. This cleans up a lot of the code pathes, and with the sparse annotations for the new sense_reason_t type allows for much better error checking. (nab: Convert spc_emulate_modesense + spc_emulate_modeselect to use sense_reason_t with Roland's MODE SELECT changes) Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Nicholas Bellinger authored
This patch fixes a new off-by-one bug in the hardcoded starting offset of spc_emulate_modesense() code that causes BLOCK DESCRIPTOR to be incorrectly written within the MEDIUM TYPE buffer area of the mode parameter header. According to spc4r30, Section 7.5.4, BLOCK DESCRIPTOR for MODE_SENSE_10 starts at byte 3, and BLOCK_DESCRIPTOR for MODE_SENSE (6) starts at byte 2. (roland: add MODE DATA LENGTH + MEDIUM TYPE offset comment) Cc: Roland Dreier <roland@purestorage.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
This is another thing that compliance tests try, and it's easy to implement on top of the MODE SENSE refactoring; since we don't claim to support any changeable values, all we need to do is check that the page contents sent by the initiator match what we would return. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
The Windows SCSI compliance test asks for this mode page, and it's easy to implement: we can just return all 0s to show we don't support any of these features. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
Convert spc_emulate_modesense() to use a table of mode pages, rather than a switch statement. This makes it possible to add more pages sanely -- in particular we no longer need to make sure we keep the 0x3f (return all mode pages) case in sync. While we're touching this code, make our MODE SENSE emulation a bit better in a couple of ways: - When the initiator passes PC == 1 asking for changeable values, return all 0s to show we don't support setting anything. - Return a block descriptor for disk devices. (nab: fix up device attribute references to use dev->dev_attrib in for-next code) Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Roland Dreier authored
Instead of using the obfuscated pattern of list_for_each_entry(var, list, ...) break; to set var to the first entry of a list, use the straightforward var = list_first_entry(list, ...); Reported-by: Joern Engel <joern@logfs.org> Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Christoph Hellwig authored
Now that the reservations and ALUA code have been cleaned up there is no need for the get_device_rev method, as we only need the standards revision in the inquiry data, where we can hardcode it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Christoph Hellwig authored
We always support ALUA for virtual backends, and never for physical ones. Simplify the code to just deal with these two cases and remove the superflous abstractions. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-
Christoph Hellwig authored
We do not support host-level reservations for the pscsi backend, and all virtual backends are newere than SCSI-2, so just make the combined SPC-3 + SCSI-2 support the only supported variant and kill the switches for the different implementations, given that this code handles the no-op version just fine. (hch: Update DRF_SPC2_RESERVATIONS lock usage) Signed-off-by: Christoph Hellwig <hch@lst.de>
-