Accepting request 344818 from home:lee_duncan:branches:Base:System

- Adding upstream patch to silence bogus error
  message when backing-store directory not present
  (bsc#954801), adding patch:
  * tgt-missing-module-directory-not-an-error 

- Added upstream patch to handle possible target removal
  while accessing it (bsc#922526), adding patch:
  * tgt-handle-access-of-a-target-that-has-been-removed

OBS-URL: https://build.opensuse.org/request/show/344818
OBS-URL: https://build.opensuse.org/package/show/Base:System/tgt?expand=0&rev=35
This commit is contained in:
Lee Duncan 2015-11-16 21:52:21 +00:00 committed by Git OBS Bridge
parent 58e51fd5f0
commit a9712ec8ea
4 changed files with 101 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 28 Oct 2015 14:16:13 +0900
Subject: Handle access of a target that has been removed
Git-commit: 2791ed243ab2a2fcfe48aea4a0cc23f4ad8467dc
Patch-mainline: v1.0.61
I recently got a report of a tgtd core dump from our opencloud
group. The stack trace showed that a strcmp against a NULL was causing
the failure:
----------------------------------------------------------------
Program terminated with signal 11, Segmentation fault.
(gdb) bt
name=0x6ac16f "iqn.2010-10.org.openstack:volume-e812c705-80bc-4064-a84c-5559cda8b1ca") at iscsi/target.c:216
at iscsi/iscsid.c:654
events=1, data=0x63a480 <target_list>) at iscsi/iscsi_tcp.c:158
----------------------------------------------------------------
It looks like target_find_by_name() uses tgt_targetname(), but doesn't
account for the fact that it can return a NULL when the target being
looked up does not (now) exist:
----------------------------------------------------------------
char *tgt_targetname(int tid)
{
struct target *target;
target = target_lookup(tid);
if (!target)
return NULL;
return target->name;
}
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Lee Duncan <lduncan@suse.com>
---
usr/iscsi/target.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -369,9 +369,11 @@ void target_list_build(struct iscsi_conn
struct iscsi_target *target_find_by_name(const char *name)
{
struct iscsi_target *target;
+ char *tname;
list_for_each_entry(target, &iscsi_targets_list, tlist) {
- if (!strcmp(tgt_targetname(target->tid), name))
+ tname = tgt_targetname(target->tid);
+ if (tname && !strcmp(tname, name))
return target;
}

View File

@ -0,0 +1,26 @@
From: Lee Duncan <lduncan@suse.com>
Date: Mon Nov 16 08:49:57 PST 2015
Subject: backing-store modules directory not present is not an error
The backing-store modules directory, normally
/usr/lib/tgt/backing-store, is not created, needed, or used when there
are no backing store modules. So change the error message printed when
the directory is not present to a debug message.
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
usr/bs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/usr/bs.c
+++ b/usr/bs.c
@@ -263,7 +263,8 @@ static int bs_init_signalfd(void)
dir = opendir(BSDIR);
if (dir == NULL) {
- eprintf("could not open backing-store module directory %s\n",
+ /* not considered an error if there are no modules */
+ dprintf("could not open backing-store module directory %s\n",
BSDIR);
} else {
struct dirent *dirent;

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Nov 16 16:43:18 UTC 2015 - lduncan@suse.com
- Adding upstream patch to silence bogus error
message when backing-store directory not present
(bsc#954801), adding patch:
* tgt-missing-module-directory-not-an-error
-------------------------------------------------------------------
Mon Nov 16 00:54:26 UTC 2015 - lduncan@suse.com
- Added upstream patch to handle possible target removal
while accessing it (bsc#922526), adding patch:
* tgt-handle-access-of-a-target-that-has-been-removed
-------------------------------------------------------------------
Fri Sep 18 09:52:28 UTC 2015 - p.drouand@gmail.com

View File

@ -29,6 +29,8 @@ Source3: %{name}.services
Source4: sysconfig.%{name}
Patch2: %{name}-fix-build
Patch3: setup-tgt-conf-d.patch
Patch4: %{name}-handle-access-of-a-target-that-has-been-removed
Patch5: %{name}-missing-module-directory-not-an-error
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libaio-devel
BuildRequires: libxslt
@ -51,6 +53,8 @@ user-space daemon and tools (i.e. they completely runs in user space).
%setup -q
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%ifarch ppc ppc64 ppc64le
@ -93,4 +97,4 @@ ln -sf service %{buildroot}/%{_sbindir}/rc%{name}d
%doc doc/README.mmc doc/README.passthrough doc/README.sbcjukebox doc/README.ssc
%{_mandir}/man8/*
%changelog
%changelog