<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/target/iscsi, branch linux-3.5.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>iscsi-target: Drop bogus struct file usage for iSCSI/SCTP</title>
<updated>2012-08-09T15:22:35+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2012-07-21T07:55:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d2dcab7be28c5431ac85bc88face77fcb91503d5'/>
<id>d2dcab7be28c5431ac85bc88face77fcb91503d5</id>
<content type='text'>
commit bf6932f44a7b3fa7e2246a8b18a44670e5eab6c2 upstream.

From Al Viro:

	BTW, speaking of struct file treatment related to sockets -
        there's this piece of code in iscsi:
        /*
         * The SCTP stack needs struct socket-&gt;file.
         */
        if ((np-&gt;np_network_transport == ISCSI_SCTP_TCP) ||
            (np-&gt;np_network_transport == ISCSI_SCTP_UDP)) {
                if (!new_sock-&gt;file) {
                        new_sock-&gt;file = kzalloc(
                                        sizeof(struct file), GFP_KERNEL);

For one thing, as far as I can see it'not true - sctp does *not* depend on
socket-&gt;file being non-NULL; it does, in one place, check socket-&gt;file-&gt;f_flags
for O_NONBLOCK, but there it treats NULL socket-&gt;file as "flag not set".
Which is the case here anyway - the fake struct file created in
__iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with
the same excuse) do *not* get that flag set.

Moreover, it's a bloody serious violation of a bunch of asserts in VFS;
all struct file instances should come from filp_cachep, via get_empty_filp()
(or alloc_file(), which is a wrapper for it).  FWIW, I'm very tempted to
do this and be done with the entire mess:

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Andy Grover &lt;agrover@redhat.com&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit bf6932f44a7b3fa7e2246a8b18a44670e5eab6c2 upstream.

From Al Viro:

	BTW, speaking of struct file treatment related to sockets -
        there's this piece of code in iscsi:
        /*
         * The SCTP stack needs struct socket-&gt;file.
         */
        if ((np-&gt;np_network_transport == ISCSI_SCTP_TCP) ||
            (np-&gt;np_network_transport == ISCSI_SCTP_UDP)) {
                if (!new_sock-&gt;file) {
                        new_sock-&gt;file = kzalloc(
                                        sizeof(struct file), GFP_KERNEL);

For one thing, as far as I can see it'not true - sctp does *not* depend on
socket-&gt;file being non-NULL; it does, in one place, check socket-&gt;file-&gt;f_flags
for O_NONBLOCK, but there it treats NULL socket-&gt;file as "flag not set".
Which is the case here anyway - the fake struct file created in
__iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with
the same excuse) do *not* get that flag set.

Moreover, it's a bloody serious violation of a bunch of asserts in VFS;
all struct file instances should come from filp_cachep, via get_empty_filp()
(or alloc_file(), which is a wrapper for it).  FWIW, I'm very tempted to
do this and be done with the entire mess:

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Andy Grover &lt;agrover@redhat.com&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>iscsi-target: Fix iov_count calculation bug in iscsit_allocate_iovecs</title>
<updated>2012-05-21T00:25:24+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2012-05-21T00:10:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f80e8ed3951455272c12693e35b259be8eb60b30'/>
<id>f80e8ed3951455272c12693e35b259be8eb60b30</id>
<content type='text'>
This patch fixes a bug in iscsit_allocate_iovecs() where iov_count was
incorrectly calculated using min(1UL, data_length / PAGE_SIZE) instead of
max(1UL, data_length / PAGE_SIZE), that ends up triggering an OOPs for
large block I/O when the SGL &lt;-&gt; iovec mapping exceeds the bogus iov_count
allocation size.

This is a regression introduced during the iscsi-target conversion back
to using core memory allocation here:

commit bfb79eac2026b411df9e253a9c350039b4b04bb7
Author: Andy Grover &lt;agrover@redhat.com&gt;
Date:   Tue Apr 3 15:51:29 2012 -0700

    target/iscsi: Go back to core allocating data buffer for cmd

Cc: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes a bug in iscsit_allocate_iovecs() where iov_count was
incorrectly calculated using min(1UL, data_length / PAGE_SIZE) instead of
max(1UL, data_length / PAGE_SIZE), that ends up triggering an OOPs for
large block I/O when the SGL &lt;-&gt; iovec mapping exceeds the bogus iov_count
allocation size.

This is a regression introduced during the iscsi-target conversion back
to using core memory allocation here:

commit bfb79eac2026b411df9e253a9c350039b4b04bb7
Author: Andy Grover &lt;agrover@redhat.com&gt;
Date:   Tue Apr 3 15:51:29 2012 -0700

    target/iscsi: Go back to core allocating data buffer for cmd

Cc: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>iscsi-target: remove dead code in iscsi_check_valuelist_for_support</title>
<updated>2012-05-17T19:04:53+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2012-05-17T07:08:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b1e41d8cd43910fee82f27ab1381bc6cd66910b3'/>
<id>b1e41d8cd43910fee82f27ab1381bc6cd66910b3</id>
<content type='text'>
Neither "acceptor_values" nor "proposer_values" can be NULL here when
scanning the value lists for incoming iSCSI login parameters such as
HeaderDigest=CRC32C,None.

Smatch complains because we are not allowed to pass NULL pointers to
strchr().  Also I removed a second later check for "!acceptor_values"
because it gets checked on the next line in the do while condition.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Neither "acceptor_values" nor "proposer_values" can be NULL here when
scanning the value lists for incoming iSCSI login parameters such as
HeaderDigest=CRC32C,None.

Smatch complains because we are not allowed to pass NULL pointers to
strchr().  Also I removed a second later check for "!acceptor_values"
because it gets checked on the next line in the do while condition.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: cleanup some allocation style issues</title>
<updated>2012-05-06T22:02:33+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2012-04-17T06:33:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=381e309a658feadb48c14566b3b26ccb7eec75a0'/>
<id>381e309a658feadb48c14566b3b26ccb7eec75a0</id>
<content type='text'>
We can use kcalloc() here instead of kzalloc().  It's better style and
it has overflow checking built in.

Also -ENOMEM is the correct error code for allocation errors.  -1 means
-EPERM.  None of the callers preserve the error codes so it doesn't
matter except as a cleanup.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can use kcalloc() here instead of kzalloc().  It's better style and
it has overflow checking built in.

Also -ENOMEM is the correct error code for allocation errors.  -1 means
-EPERM.  None of the callers preserve the error codes so it doesn't
matter except as a cleanup.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: Go back to core allocating data buffer for cmd</title>
<updated>2012-04-15T00:40:39+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bfb79eac2026b411df9e253a9c350039b4b04bb7'/>
<id>bfb79eac2026b411df9e253a9c350039b4b04bb7</id>
<content type='text'>
We originally changed iscsi to allocate its own buffers just as an
intermediate step to clean up some core buffer allocation mechanisms. Now
we can put it back.

Also had to change allocate_iovecs to use data_length instead of
t_data_nents because iovecs are now allocated before the data buffer, thus
t_data_nents is not yet initialized.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We originally changed iscsi to allocate its own buffers just as an
intermediate step to clean up some core buffer allocation mechanisms. Now
we can put it back.

Also had to change allocate_iovecs to use data_length instead of
t_data_nents because iovecs are now allocated before the data buffer, thus
t_data_nents is not yet initialized.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: Fold _decide_list_to_build into _build_pdu_and_seq_lists</title>
<updated>2012-04-15T00:40:38+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4334e49bcae6f4602eb5c52158b8fb89d8941d99'/>
<id>4334e49bcae6f4602eb5c52158b8fb89d8941d99</id>
<content type='text'>
Rename iscsit_build_pdu_and_seq_list to iscsit_do_build_pdu_and_seq_lists

Rename iscsit_do_build_list to iscsit_build_pdu_and_seq_lists

Move code from iscsit_decide_list_to_build into _seq_pdu_list.c, seems
a better fit.

Also update some comments in pdu/seq code for correctness and whitespace.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename iscsit_build_pdu_and_seq_list to iscsit_do_build_pdu_and_seq_lists

Rename iscsit_do_build_list to iscsit_build_pdu_and_seq_lists

Move code from iscsit_decide_list_to_build into _seq_pdu_list.c, seems
a better fit.

Also update some comments in pdu/seq code for correctness and whitespace.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: Eliminate iscsi_cmd.data_length</title>
<updated>2012-04-15T00:40:38+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ebf1d95ca297a06fe760177b614646dcec06abef'/>
<id>ebf1d95ca297a06fe760177b614646dcec06abef</id>
<content type='text'>
Redundant, just use iscsi_cmd-&gt;se_cmd.data_length once se_cmd is
initialized, or hdr-&gt;data_length before then.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Redundant, just use iscsi_cmd-&gt;se_cmd.data_length once se_cmd is
initialized, or hdr-&gt;data_length before then.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: Move init_se_cmd closer to lookup_cmd_lun</title>
<updated>2012-04-15T00:40:37+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=065ca1e42ffd74dd03cf60f61cead35934c91ed5'/>
<id>065ca1e42ffd74dd03cf60f61cead35934c91ed5</id>
<content type='text'>
if we can get calls to init_se_cmd, get_sess_cmd, lookup_cmd_lun,
core_alua_check_nonop_delay, and handle_cdb_direct next to each other,
then we can just call target_submit_cmd. This is a step towards that
goal.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
if we can get calls to init_se_cmd, get_sess_cmd, lookup_cmd_lun,
core_alua_check_nonop_delay, and handle_cdb_direct next to each other,
then we can just call target_submit_cmd. This is a step towards that
goal.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target/iscsi: Inline iscsit_allocate_se_cmd and *_for_tmr</title>
<updated>2012-04-15T00:40:37+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d28b11692e6ec577cec70606d793e14843124a03'/>
<id>d28b11692e6ec577cec70606d793e14843124a03</id>
<content type='text'>
Trying to move a bunch of stuff around so iscsi can use target_submit_cmd
someday, and so stuff needs to be in that function directly instead of
hidden, so it can be reordered etc.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Trying to move a bunch of stuff around so iscsi can use target_submit_cmd
someday, and so stuff needs to be in that function directly instead of
hidden, so it can be reordered etc.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Rename target_allocate_tasks to target_setup_cmd_from_cdb</title>
<updated>2012-04-15T00:40:36+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2012-04-03T22:51:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a12f41f8412ff57057906ebbe146fda37db158ac'/>
<id>a12f41f8412ff57057906ebbe146fda37db158ac</id>
<content type='text'>
This patch renames a horribly misnamed function that no longer allocate
tasks to something more descriptive for it's modern use in target core.

(nab: Fix up ib_srpt to use this as well ahead of a target_submit_cmd
conversion)

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch renames a horribly misnamed function that no longer allocate
tasks to something more descriptive for it's modern use in target core.

(nab: Fix up ib_srpt to use this as well ahead of a target_submit_cmd
conversion)

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
