mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 02:31:27 +00:00
Merge with IET r196:
- Allow removal of kernel target objects if the user space object does not exist Based on a patch by Lars Ellenberg. Signed-off-by: Arne Redlich <agr@powerkom-dd.de> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@653 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -81,22 +81,23 @@ static void all_accounts_del(u32 tid, int dir)
|
||||
|
||||
int target_del(u32 tid)
|
||||
{
|
||||
int err;
|
||||
struct target* target;
|
||||
struct target *target = target_find_by_id(tid);
|
||||
int err = ki->target_destroy(tid);
|
||||
|
||||
if (!(target = target_find_by_id(tid)))
|
||||
if (err < 0 && errno != ENOENT)
|
||||
return -errno;
|
||||
else if (!err && !target)
|
||||
/* A leftover kernel object was cleaned up - don't complain. */
|
||||
return 0;
|
||||
|
||||
if (!target)
|
||||
return -ENOENT;
|
||||
|
||||
if (target->nr_sessions)
|
||||
return -EBUSY;
|
||||
|
||||
if ((err = target_destroy(tid)) < 0)
|
||||
return err;
|
||||
|
||||
remque(&target->tlist);
|
||||
|
||||
if (!list_empty(&target->sessions_list)) {
|
||||
log_error("%s still have sessions %d\n", __func__, tid);
|
||||
log_error("%s: target %u still has sessions\n", __FUNCTION__,
|
||||
tid);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user