import targetcli-2.1.53-2.el8

This commit is contained in:
CentOS Sources 2020-12-03 06:11:28 +00:00 committed by Andrew Lukoshko
parent ddcc5994ee
commit 98a73c7ea2
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 3176671662bda79d4b4059b8cc22b4b31a6547e0 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Fri, 13 Nov 2020 11:44:40 +0100
Subject: [PATCH] fileio backstore: fix sparse file creation
fallocate() can't be used to create sparse files because it
actually preallocates all the disk space that will be used by the file
backstore, sparse files do not have preallocated disk space
by definition.
We must therefore use ftruncate().
We can, on the other hand, use fallocate() to create non-sparse
files and fall back to the slower "while() fwrite()" if we
are running on Python version < 3.3 where fallocate() is not available
Fixes 3bd4d8ef7c9b154c53e8b8dd863a570bce7f5c2c
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
targetcli/ui_backstore.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 8692f22..9bc0c58 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -423,17 +423,17 @@ class UIFileIOBackstore(UIBackstore):
raise ExecutionError("Could not open %s" % filename)
try:
if sparse:
+ os.ftruncate(f.fileno(), size)
+ else:
+ self.shell.log.info("Writing %d bytes" % size)
try:
+ # Prior to version 3.3, Python does not provide fallocate
os.posix_fallocate(f.fileno(), 0, size)
except AttributeError:
- # Prior to version 3.3, Python does not provide fallocate
- os.ftruncate(f.fileno(), size)
- else:
- self.shell.log.info("Writing %d bytes" % size)
- while size > 0:
- write_size = min(size, 1024)
- f.write("\0" * write_size)
- size -= write_size
+ while size > 0:
+ write_size = min(size, 1024)
+ f.write("\0" * write_size)
+ size -= write_size
except (OSError, IOError):
os.remove(filename)
raise ExecutionError("Could not expand file to %d bytes" % size)
--
2.28.0

View File

@ -5,10 +5,11 @@ License: ASL 2.0
Group: System Environment/Libraries Group: System Environment/Libraries
Summary: An administration shell for storage targets Summary: An administration shell for storage targets
Version: 2.1.53 Version: 2.1.53
Release: 1%{?dist} Release: 2%{?dist}
URL: https://github.com/open-iscsi/%{oname} URL: https://github.com/open-iscsi/%{oname}
Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz
Patch0: 0001-setup.py-add-the-socket-and-service-files-to-the-dat.patch Patch0: 0001-setup.py-add-the-socket-and-service-files-to-the-dat.patch
Patch1: 0002-fileio-backstore-fix-sparse-file-creation.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel, python3-setuptools BuildRequires: python3-devel, python3-setuptools
Requires: python3-rtslib, target-restore, python3-configshell, python3-six, python3-dbus, python3-gobject-base Requires: python3-rtslib, target-restore, python3-configshell, python3-six, python3-dbus, python3-gobject-base
@ -23,6 +24,7 @@ users will also need to install and use fcoe-utils.
%prep %prep
%setup -q -n %{oname}-%{version} %setup -q -n %{oname}-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
%build %build
%{__python3} setup.py build %{__python3} setup.py build
@ -52,6 +54,9 @@ install -m 644 targetclid.8.gz %{buildroot}%{_mandir}/man8/
%{_usr}/lib/systemd/system/targetclid.socket %{_usr}/lib/systemd/system/targetclid.socket
%changelog %changelog
* Tue Dec 01 2020 Maurizio Lombardi <mlombard@redhat.com> - 2.1.53-2
- Fix sparse file creation
* Thu Jun 25 2020 Maurizio Lombardi <mlombard@redhat.com> - 2.1.53-1 * Thu Jun 25 2020 Maurizio Lombardi <mlombard@redhat.com> - 2.1.53-1
- Update to new upstream version - Update to new upstream version