Accepting request 624143 from home:jeff_mahoney:branches:filesystems

- mkfs: avoid divide-by-zero when hardware reports optimal i/o size as 0
  (bsc#1089777).
  * Added xfsprogs-mkfs-avoid-divide-by-zero-when-hardware-reports-opti.patch

- Revert to %doc for license in SLE11 and SLE12.
- xfsprogs-devel should depend on uuid-devel to build on SLE11 and
  match the package's build dependencies.

OBS-URL: https://build.opensuse.org/request/show/624143
OBS-URL: https://build.opensuse.org/package/show/filesystems/xfsprogs?expand=0&rev=74
This commit is contained in:
Jeff Mahoney 2018-07-20 00:13:50 +00:00 committed by Git OBS Bridge
parent c9e83b84e7
commit 313f81c462
3 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From: Jeffrey Mahoney <jeffm@suse.com>
Subject: [PATCH] mkfs: avoid divide-by-zero when hardware reports optimal i/o
size as 0
Patch-mainline: Submitted to linux-xfs, 19 Jul 2018
References: bsc#1089777
Commit 051b4e37f5e (mkfs: factor AG alignment) factored out the
AG alignment code into a separate function. It got rid of
redundant checks for dswidth != 0 since calc_stripe_factors was
supposed to guarantee that if dsunit is non-zero dswidth will be
as well. Unfortunately, there's hardware out there that reports its
optimal i/o size as larger than the maximum i/o size, which the kernel
treats as broken and zeros out the optimal i/o size. We'll accept
the multi-sector dsunit but have a zero dswidth and hit a divide-by-zero
in align_ag_geometry.
To resolve this we can check the topology before consuming it, default
to using the stripe unit as the stripe width, and warn the user about it.
Fixes: 051b4e37f5e (mkfs: factor AG alignment)
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
mkfs/xfs_mkfs.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index a135e06e..35542e57 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2295,6 +2295,12 @@ _("data stripe width (%d) must be a multiple of the data stripe unit (%d)\n"),
if (!dsunit) {
dsunit = ft->dsunit;
dswidth = ft->dswidth;
+ if (dsunit && dswidth == 0) {
+ fprintf(stderr,
+_("%s: Volume reports stripe unit of %d bytes but stripe width of 0. Using stripe width of %d bytes, which may not be optimal.\n"),
+ progname, dsunit << 9, dsunit << 9);
+ dswidth = dsunit;
+ }
use_dev = true;
} else {
/* check and warn is alignment is sub-optimal */
--
2.16.4

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Jul 20 00:07:14 UTC 2018 - jeffm@suse.com
- mkfs: avoid divide-by-zero when hardware reports optimal i/o size as 0
(bsc#1089777).
* Added xfsprogs-mkfs-avoid-divide-by-zero-when-hardware-reports-opti.patch
-------------------------------------------------------------------
Wed Jul 18 21:49:33 UTC 2018 - jeffm@suse.com
- Revert to %doc for license in SLE11 and SLE12.
- xfsprogs-devel should depend on uuid-devel to build on SLE11 and
match the package's build dependencies.
-------------------------------------------------------------------
Tue Jul 3 12:14:02 UTC 2018 - tchvatal@suse.com

View File

@ -24,6 +24,7 @@
%bcond_with systemd
%endif
%define libname libhandle1
Name: xfsprogs
Version: 4.16.1
Release: 0
@ -37,6 +38,7 @@ Source2: %{name}.keyring
Source3: module-setup.sh.in
Source4: dracut-fsck-help.txt
Patch0: xfsprogs-docdir.diff
Patch1: xfsprogs-mkfs-avoid-divide-by-zero-when-hardware-reports-opti.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libblkid-devel
@ -84,8 +86,8 @@ library for your own new xfs tools install xfsprogs-devel.
Summary: XFS Filesystem-specific Static Libraries and Headers
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: libuuid-devel
Requires: xfsprogs = %{version}
Requires: pkgconfig(uuid)
%description devel
xfsprogs-devel contains the libraries and header files needed to
@ -98,6 +100,7 @@ want to install xfsprogs.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
aclocal -I m4
@ -181,8 +184,11 @@ install -m 0644 %{SOURCE4} %{buildroot}/%{_dracutmodulesdir}/95suse-xfs/
%{_mandir}/man[258]/*
%doc %{_defaultdocdir}/%{name}
%if 0%{?suse_version} >= 1315
# SLE12 doesn't do %license
%if 0%{?suse_version} > 1315 || 0%{?is_opensuse}
%license doc/COPYING
%endif
%endif
%dir %{_libexecdir}/dracut
%dir %{_libexecdir}/dracut/modules.d
%dir %{_dracutmodulesdir}/95suse-xfs/