Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4113e47b
Commit
4113e47b
authored
Dec 21, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iscsi_target: deal with short writes on the tx side
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c9f2b6ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
40 deletions
+24
-40
drivers/target/iscsi/iscsi_target_util.c
drivers/target/iscsi/iscsi_target_util.c
+24
-40
No files found.
drivers/target/iscsi/iscsi_target_util.c
View file @
4113e47b
...
...
@@ -1304,39 +1304,6 @@ static int iscsit_do_rx_data(
return
total_rx
;
}
static
int
iscsit_do_tx_data
(
struct
iscsi_conn
*
conn
,
struct
iscsi_data_count
*
count
)
{
int
ret
,
iov_len
;
struct
kvec
*
iov_p
;
struct
msghdr
msg
;
if
(
!
conn
||
!
conn
->
sock
||
!
conn
->
conn_ops
)
return
-
1
;
if
(
count
->
data_length
<=
0
)
{
pr_err
(
"Data length is: %d
\n
"
,
count
->
data_length
);
return
-
1
;
}
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
iov_p
=
count
->
iov
;
iov_len
=
count
->
iov_count
;
ret
=
kernel_sendmsg
(
conn
->
sock
,
&
msg
,
iov_p
,
iov_len
,
count
->
data_length
);
if
(
ret
!=
count
->
data_length
)
{
pr_err
(
"Unexpected ret: %d send data %d
\n
"
,
ret
,
count
->
data_length
);
return
-
EPIPE
;
}
pr_debug
(
"ret: %d, sent data: %d
\n
"
,
ret
,
count
->
data_length
);
return
ret
;
}
int
rx_data
(
struct
iscsi_conn
*
conn
,
struct
kvec
*
iov
,
...
...
@@ -1363,18 +1330,35 @@ int tx_data(
int
iov_count
,
int
data
)
{
struct
iscsi_data_count
c
;
struct
msghdr
msg
;
int
total_tx
=
0
;
if
(
!
conn
||
!
conn
->
sock
||
!
conn
->
conn_ops
)
return
-
1
;
memset
(
&
c
,
0
,
sizeof
(
struct
iscsi_data_count
));
c
.
iov
=
iov
;
c
.
iov_count
=
iov_count
;
c
.
data_length
=
data
;
c
.
type
=
ISCSI_TX_DATA
;
if
(
data
<=
0
)
{
pr_err
(
"Data length is: %d
\n
"
,
data
);
return
-
1
;
}
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
iov_iter_kvec
(
&
msg
.
msg_iter
,
WRITE
|
ITER_KVEC
,
iov
,
iov_count
,
data
);
while
(
msg_data_left
(
&
msg
))
{
int
tx_loop
=
sock_sendmsg
(
conn
->
sock
,
&
msg
);
if
(
tx_loop
<=
0
)
{
pr_debug
(
"tx_loop: %d total_tx %d
\n
"
,
tx_loop
,
total_tx
);
return
tx_loop
;
}
total_tx
+=
tx_loop
;
pr_debug
(
"tx_loop: %d, total_tx: %d, data: %d
\n
"
,
tx_loop
,
total_tx
,
data
);
}
return
iscsit_do_tx_data
(
conn
,
&
c
)
;
return
total_tx
;
}
static
bool
sockaddr_equal
(
struct
sockaddr_storage
*
x
,
struct
sockaddr_storage
*
y
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment