[stgt] [PATCH] mgmt: fixed -m system -o delete handling
Roi Dayan
roid at mellanox.com
Thu Jun 28 18:56:04 CEST 2012
system_active was reset only in case when mgmt response was carrying data.
In case of deleting system, response code was returned in err field of the header
therefore system was not shut down.
Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
Signed-off-by: Roi Dayan <roid at mellanox.com>
---
Hi Tomo,
This patch will fix shut down of the system with
tgtadm -m system -o delete
which otherwise gets stuck.
Thanks,
Roi
usr/mgmt.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/usr/mgmt.c b/usr/mgmt.c
index ef1b265..56f89bb 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -585,13 +585,8 @@ static void mtask_recv_send_handler(int fd, int events, void *data)
err = concat_write(&mtask->rsp_concat, fd, mtask->done);
if (err >= 0) {
mtask->done += err;
- if (mtask->done == (rsp->len - sizeof(*rsp))) {
- if (req->mode == MODE_SYSTEM &&
- req->op == OP_DELETE &&
- !rsp->err)
- system_active = 0;
+ if (mtask->done == (rsp->len - sizeof(*rsp)))
goto out;
- }
} else
if (errno != EAGAIN)
goto out;
@@ -603,6 +598,8 @@ static void mtask_recv_send_handler(int fd, int events, void *data)
return;
out:
+ if (req->mode == MODE_SYSTEM && req->op == OP_DELETE && !rsp->err)
+ system_active = 0;
tgt_event_del(fd);
close(fd);
mtask_free(mtask);
--
1.7.8.2
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list