Accepting request 686299 from home:michael-chang:branches:Base:System

- Use %doc for older products for compatibility, or may end up with
  unsuccessful build result
  * grub2.spec

- Revert grub2-ieee1275-open-raw-mode.patch for regression of crashing lvm on
  multipath SAN (bsc#1113702)
  * deleted grub2-ieee1275-open-raw-mode.patch
- Add exception handling to FCP lun enumeration (bsc#1113702)
  * grub2-ieee1275-FCP-methods-for-WWPN-and-LUNs.patch

OBS-URL: https://build.opensuse.org/request/show/686299
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=331
This commit is contained in:
Michael Chang 2019-03-19 06:52:40 +00:00 committed by Git OBS Bridge
parent eca6f02414
commit 943cb82413
4 changed files with 78 additions and 97 deletions

View File

@ -1,8 +1,7 @@
From a7a3ad361b4a75d052e9b4389b44a9f3848f3b9f Mon Sep 17 00:00:00 2001
From: Diego Domingos <diegodo@linux.vnet.ibm.com>
Date: Fri, 10 Aug 2018 16:29:50 -0400
Subject: ieee1275: implement FCP methods for WWPN and LUNs
References: bsc#1093145
Patch-mainline: not yet
Subject: [PATCH] ieee1275: implement FCP methods for WWPN and LUNs
This patch enables the fcp-targets and fcp-luns methods which are
responsible to get WWPNs and LUNs for fibre channel devices.
@ -13,21 +12,21 @@ to find the WWPNs and LUNs when called by searchfs.uuid tool.
Signed-off-by: Diego Domingos <diegodo@linux.vnet.ibm.com>
---
grub-core/disk/ieee1275/ofdisk.c | 89 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 88 insertions(+), 1 deletion(-)
grub-core/disk/ieee1275/ofdisk.c | 109 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 108 insertions(+), 1 deletion(-)
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index 235c0fe..bb213f1 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -209,7 +209,94 @@ dev_iterate_real (const char *name, const char *path)
Index: grub-2.02/grub-core/disk/ieee1275/ofdisk.c
===================================================================
--- grub-2.02.orig/grub-core/disk/ieee1275/ofdisk.c
+++ grub-2.02/grub-core/disk/ieee1275/ofdisk.c
@@ -209,7 +209,118 @@ dev_iterate_real (const char *name, cons
static void
dev_iterate (const struct grub_ieee1275_devalias *alias)
{
- if (grub_strcmp (alias->type, "vscsi") == 0)
+ if (grub_strcmp (alias->type, "fcp") == 0){
+
+ /* If we are dealing with fcp devices, we need
+ /* If we are dealing with fcp devices, we need
+ * to find the WWPNs and LUNs to iterate them */
+ grub_ieee1275_ihandle_t ihandle;
+ grub_uint64_t *ptr_targets, *ptr_luns;
@ -56,7 +55,11 @@ index 235c0fe..bb213f1 100644
+ grub_ieee1275_cell_t table;
+ } args_luns;
+
+ grub_ieee1275_open (alias->path, &ihandle);
+ if(grub_ieee1275_open (alias->path, &ihandle))
+ {
+ grub_dprintf("disk", "failed to open the disk while iterating FCP disk path=%s\n", alias->path);
+ return;
+ }
+
+ INIT_IEEE1275_COMMON (&args_targets.common, "call-method", 2, 3);
+ args_targets.method = (grub_ieee1275_cell_t) "fcp-targets";
@ -70,41 +73,61 @@ index 235c0fe..bb213f1 100644
+ args_luns.table = 0;
+ args_luns.nentries = 0;
+
+ IEEE1275_CALL_ENTRY_FN (&args_targets);
+ if (IEEE1275_CALL_ENTRY_FN (&args_targets) == -1)
+ {
+ grub_dprintf("disk", "failed to get the targets while iterating FCP disk path=%s\n", alias->path);
+ grub_ieee1275_close(ihandle);
+ return;
+ }
+
+ buf = grub_malloc (grub_strlen (alias->path) + 32 + 32);
+
+ if (!buf)
+ return;
+ {
+ grub_ieee1275_close(ihandle);
+ return;
+ }
+
+ bufptr = grub_stpcpy (buf, alias->path);
+
+ /* For each WWPN discovered we need to find his associated LUNS
+ * calling the fcp-luns method */
+ for (i=0; i< args_targets.nentries; i++){
+ ptr_targets = *(grub_uint64_t **) (args_targets.table + 4 + 8 * i);
+ while(*ptr_targets){
+ args_luns.wwpn_l = (grub_ieee1275_cell_t) (*ptr_targets);
+ args_luns.wwpn_h = (grub_ieee1275_cell_t) (*ptr_targets >> 32);
+ pos=grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T,
+ for (i=0; i< args_targets.nentries; i++)
+ {
+ ptr_targets = *(grub_uint64_t **) (args_targets.table + 4 + 8 * i);
+ while(*ptr_targets)
+ {
+ args_luns.wwpn_l = (grub_ieee1275_cell_t) (*ptr_targets);
+ args_luns.wwpn_h = (grub_ieee1275_cell_t) (*ptr_targets >> 32);
+ pos=grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T,
+ *ptr_targets++);
+ IEEE1275_CALL_ENTRY_FN (&args_luns);
+ ptr_luns = *(grub_uint64_t **) (args_luns.table);
+
+ for(j=0;j<args_luns.nentries; j++){
+ ptr_luns = *(grub_uint64_t **) (args_luns.table + 4 + 8*j);
+
+ do {
+ if (*ptr_luns == 0){
+ dev_iterate_real(buf,buf);
+ continue;
+ }
+ grub_snprintf (&bufptr[pos], 30, ",%" PRIxGRUB_UINT64_T,
+ *ptr_luns++);
+ dev_iterate_real(buf,buf);
+ } while(*ptr_luns);
+ }
+ if (IEEE1275_CALL_ENTRY_FN (&args_luns) == -1)
+ {
+ grub_dprintf("disk", "failed to get the LUNS while iterating FCP disk path=%s\n", buf);
+ grub_ieee1275_close (ihandle);
+ grub_free (buf);
+ return;
+ }
+
+ for(j=0;j<args_luns.nentries; j++)
+ {
+ ptr_luns = *(grub_uint64_t **) (args_luns.table + 4 + 8*j);
+
+ do
+ {
+ if (*ptr_luns == 0)
+ {
+ dev_iterate_real(buf,buf);
+ ptr_luns++;
+ continue;
+ }
+ grub_snprintf (&bufptr[pos], 30, ",%" PRIxGRUB_UINT64_T,
+ *ptr_luns++);
+ dev_iterate_real(buf,buf);
+ } while(*ptr_luns);
+ }
+ }
+ }
+
+ grub_ieee1275_close (ihandle);

View File

@ -1,60 +0,0 @@
From: diegodo@br.ibm.com
References: bsc#1071559
Patch-Mainline: no
Because Openfirmware returns invalid ihandler when it tries to open a disk
which his first partition is not a supported one by the firmware (Prep, FAT,
ISO), the grub needs to understand when it should open the disk in "raw mode",
appending a ":0" in the end of the device path.
Openfirmware is unable to open disk that contains a unknown first partition
(i.e it is not a PreP, Fat, ISO) ; We needed to open the disk in "raw mode" and
so Grub was required to take care of partitions and contents.
Index: grub-2.02/grub-core/kern/ieee1275/ieee1275.c
===================================================================
--- grub-2.02.orig/grub-core/kern/ieee1275/ieee1275.c
+++ grub-2.02/grub-core/kern/ieee1275/ieee1275.c
@@ -19,6 +19,8 @@
#include <grub/ieee1275/ieee1275.h>
#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
#define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_cell_t) -1)
#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0)
@@ -458,8 +460,31 @@ grub_ieee1275_open (const char *path, gr
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
*result = args.result;
- if (args.result == IEEE1275_IHANDLE_INVALID)
- return -1;
+ if (args.result == IEEE1275_IHANDLE_INVALID){
+
+ int path_len = grub_strlen(path);
+ if ((path[path_len-3] == ':') && (path[path_len-2] == '0')){
+ return -1;
+ }
+
+ char *new_path = grub_malloc(grub_strlen(path) + 3);
+ char *optr;
+ optr = grub_stpcpy (new_path, path);
+ *optr++ = ':';
+ *optr++ = '0';
+ *optr++ = '\0';
+
+ args.path = (grub_ieee1275_cell_t) new_path;
+
+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+ return -1;
+
+ *result = args.result;
+ if (args.result == IEEE1275_IHANDLE_INVALID)
+ return -1;
+
+ }
+
return 0;
}

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Mar 19 06:14:47 UTC 2019 - mchang <mchang@suse.com>
- Use %doc for older products for compatibility, or may end up with
unsuccessful build result
* grub2.spec
-------------------------------------------------------------------
Tue Mar 19 04:18:46 UTC 2019 - mchang <mchang@suse.com>
- Revert grub2-ieee1275-open-raw-mode.patch for regression of crashing lvm on
multipath SAN (bsc#1113702)
* deleted grub2-ieee1275-open-raw-mode.patch
- Add exception handling to FCP lun enumeration (bsc#1113702)
* grub2-ieee1275-FCP-methods-for-WWPN-and-LUNs.patch
-------------------------------------------------------------------
Wed Feb 20 08:38:55 UTC 2019 - mchang@suse.com

View File

@ -265,7 +265,6 @@ Patch210: 0002-Add-Virtual-LAN-support.patch
Patch211: grub2-ppc64-cas-reboot-support.patch
Patch212: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Patch213: grub2-Fix-incorrect-netmask-on-ppc64.patch
Patch214: grub2-ieee1275-open-raw-mode.patch
Patch215: grub2-ppc64-cas-new-scope.patch
Patch216: 0001-ofnet-Initialize-structs-in-bootpath-parser.patch
Patch217: grub2-ieee1275-FCP-methods-for-WWPN-and-LUNs.patch
@ -576,7 +575,6 @@ swap partition while in resuming
%patch211 -p1
%patch212 -p1
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
%patch217 -p1
@ -1100,7 +1098,11 @@ fi
%files -f %{name}.lang
%defattr(-,root,root,-)
%if 0%{?suse_version} < 1500
%doc COPYING
%else
%license COPYING
%endif
%doc NEWS README
%doc THANKS TODO ChangeLog
%doc docs/autoiso.cfg docs/osdetect.cfg