tgt/tgt-mgmt-fixed-m-system-o-delete-handling.patch
Cristian Rodríguez b706639ebc Accepting request 139360 from home:lee_duncan:branches:Base:System
- Add tgt-mgmt-fixed-m-system-o-delete-handling.patch: Fixes
  shutdown hang (bnc#767438)
- Removed PIDFILE completely from init file, as it is not used

OBS-URL: https://build.opensuse.org/request/show/139360
OBS-URL: https://build.opensuse.org/package/show/Base:System/tgt?expand=0&rev=13
2012-10-26 13:09:51 +00:00

49 lines
1.6 KiB
Diff

From 0b88336c4b188f48e6bd2e8c94e0467dc805cc38 Mon Sep 17 00:00:00 2001
From: Roi Dayan <roid@mellanox.com>
Date: Thu, 28 Jun 2012 19:56:04 +0300
Subject: mgmt: fixed -m system -o delete handling
Git-commit: 0b88336c4b188f48e6bd2e8c94e0467dc805cc38
Patch-mainline: v1.0.29
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@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Lee Duncan <lduncan@suse.com>
---
usr/mgmt.c | 9 +++------
1 file 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);