fio: disable raw devices, fix crash on help
Resolves: rhbz#1984823 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
parent
c325bccf3a
commit
77fc91e077
133
0001-fio-remove-raw-device-support.patch
Normal file
133
0001-fio-remove-raw-device-support.patch
Normal file
@ -0,0 +1,133 @@
|
||||
From 382975557e632efb506836bc1709789e615c9094 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Sandeen <esandeen@redhat.com>
|
||||
Date: Tue, 3 Aug 2021 10:23:35 -0700
|
||||
Subject: [PATCH] fio: remove raw device support
|
||||
|
||||
As of Linux kernel commit 603e4922f1c ("remove the raw driver"),
|
||||
linux/raw.h is gone, and raw device support no longer exists.
|
||||
Because of this, fio can no longer build against the current Linux
|
||||
kernel headers.
|
||||
|
||||
So, remove raw device support from fio as well.
|
||||
|
||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
diskutil.c | 10 +++-------
|
||||
fio.1 | 4 +---
|
||||
os/os-linux.h | 32 --------------------------------
|
||||
os/os.h | 4 ----
|
||||
4 files changed, 4 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/diskutil.c b/diskutil.c
|
||||
index 0051a7a0..ace7af3d 100644
|
||||
--- a/diskutil.c
|
||||
+++ b/diskutil.c
|
||||
@@ -166,14 +166,10 @@ static int get_device_numbers(char *file_name, int *maj, int *min)
|
||||
if (S_ISBLK(st.st_mode)) {
|
||||
majdev = major(st.st_rdev);
|
||||
mindev = minor(st.st_rdev);
|
||||
- } else if (S_ISCHR(st.st_mode)) {
|
||||
- majdev = major(st.st_rdev);
|
||||
- mindev = minor(st.st_rdev);
|
||||
- if (fio_lookup_raw(st.st_rdev, &majdev, &mindev))
|
||||
- return -1;
|
||||
- } else if (S_ISFIFO(st.st_mode))
|
||||
+ } else if (S_ISCHR(st.st_mode) ||
|
||||
+ S_ISFIFO(st.st_mode)) {
|
||||
return -1;
|
||||
- else {
|
||||
+ } else {
|
||||
majdev = major(st.st_dev);
|
||||
mindev = minor(st.st_dev);
|
||||
}
|
||||
diff --git a/fio.1 b/fio.1
|
||||
index 6cc82542..9c12ad13 100644
|
||||
--- a/fio.1
|
||||
+++ b/fio.1
|
||||
@@ -1700,9 +1700,7 @@ Sets size to something really large and waits for ENOSPC (no space left on
|
||||
device) or EDQUOT (disk quota exceeded)
|
||||
as the terminating condition. Only makes sense with sequential
|
||||
write. For a read workload, the mount point will be filled first then I/O
|
||||
-started on the result. This option doesn't make sense if operating on a raw
|
||||
-device node, since the size of that is already known by the file system.
|
||||
-Additionally, writing beyond end-of-device will not return ENOSPC there.
|
||||
+started on the result.
|
||||
.SS "I/O engine"
|
||||
.TP
|
||||
.BI ioengine \fR=\fPstr
|
||||
diff --git a/os/os-linux.h b/os/os-linux.h
|
||||
index f7137abe..16ed5258 100644
|
||||
--- a/os/os-linux.h
|
||||
+++ b/os/os-linux.h
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <linux/unistd.h>
|
||||
-#include <linux/raw.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/fs.h>
|
||||
#include <scsi/sg.h>
|
||||
@@ -41,7 +40,6 @@
|
||||
#define FIO_HAVE_IOSCHED_SWITCH
|
||||
#define FIO_HAVE_ODIRECT
|
||||
#define FIO_HAVE_HUGETLB
|
||||
-#define FIO_HAVE_RAWBIND
|
||||
#define FIO_HAVE_BLKTRACE
|
||||
#define FIO_HAVE_CL_SIZE
|
||||
#define FIO_HAVE_CGROUPS
|
||||
@@ -178,36 +176,6 @@ static inline unsigned long long os_phys_mem(void)
|
||||
return (unsigned long long) pages * (unsigned long long) pagesize;
|
||||
}
|
||||
|
||||
-static inline int fio_lookup_raw(dev_t dev, int *majdev, int *mindev)
|
||||
-{
|
||||
- struct raw_config_request rq;
|
||||
- int fd;
|
||||
-
|
||||
- if (major(dev) != RAW_MAJOR)
|
||||
- return 1;
|
||||
-
|
||||
- /*
|
||||
- * we should be able to find /dev/rawctl or /dev/raw/rawctl
|
||||
- */
|
||||
- fd = open("/dev/rawctl", O_RDONLY);
|
||||
- if (fd < 0) {
|
||||
- fd = open("/dev/raw/rawctl", O_RDONLY);
|
||||
- if (fd < 0)
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- rq.raw_minor = minor(dev);
|
||||
- if (ioctl(fd, RAW_GETBIND, &rq) < 0) {
|
||||
- close(fd);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- close(fd);
|
||||
- *majdev = rq.block_major;
|
||||
- *mindev = rq.block_minor;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
#ifdef O_NOATIME
|
||||
#define FIO_O_NOATIME O_NOATIME
|
||||
#else
|
||||
diff --git a/os/os.h b/os/os.h
|
||||
index e47d3d97..17daf91d 100644
|
||||
--- a/os/os.h
|
||||
+++ b/os/os.h
|
||||
@@ -157,10 +157,6 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
|
||||
#define OS_RAND_MAX RAND_MAX
|
||||
#endif
|
||||
|
||||
-#ifndef FIO_HAVE_RAWBIND
|
||||
-#define fio_lookup_raw(dev, majdev, mindev) 1
|
||||
-#endif
|
||||
-
|
||||
#ifndef FIO_PREFERRED_ENGINE
|
||||
#define FIO_PREFERRED_ENGINE "psync"
|
||||
#endif
|
||||
--
|
||||
2.17.0
|
||||
|
51
0001-ioengines-fix-crash-with-enghelp-option.patch
Normal file
51
0001-ioengines-fix-crash-with-enghelp-option.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 2459bd33b3dbb7a34f28c612d595311a6bc7593d Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Fu <vincent.fu@samsung.com>
|
||||
Date: Wed, 4 Aug 2021 18:29:05 +0000
|
||||
Subject: [PATCH] ioengines: fix crash with --enghelp option
|
||||
|
||||
Since f6931a1dd35896433c8cc2e10de51372a2c496c4 commands like the
|
||||
following segfault:
|
||||
|
||||
fio --enghelp=sg
|
||||
fio --enghelp=sg,sg_write_mode
|
||||
|
||||
This is because free_ioengine() assumes that td->io_ops is not NULL.
|
||||
Make this true when free_ioengine() is called by
|
||||
fio_show_ioengine_help() to avoid the crash.
|
||||
|
||||
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
ioengines.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/ioengines.c b/ioengines.c
|
||||
index dd61af07..d08a511a 100644
|
||||
--- a/ioengines.c
|
||||
+++ b/ioengines.c
|
||||
@@ -692,17 +692,17 @@ int fio_show_ioengine_help(const char *engine)
|
||||
}
|
||||
|
||||
td.o.ioengine = (char *)engine;
|
||||
- io_ops = load_ioengine(&td);
|
||||
+ td.io_ops = load_ioengine(&td);
|
||||
|
||||
- if (!io_ops) {
|
||||
+ if (!td.io_ops) {
|
||||
log_info("IO engine %s not found\n", engine);
|
||||
return 1;
|
||||
}
|
||||
|
||||
- if (io_ops->options)
|
||||
- ret = show_cmd_help(io_ops->options, sep);
|
||||
+ if (td.io_ops->options)
|
||||
+ ret = show_cmd_help(td.io_ops->options, sep);
|
||||
else
|
||||
- log_info("IO engine %s has no options\n", io_ops->name);
|
||||
+ log_info("IO engine %s has no options\n", td.io_ops->name);
|
||||
|
||||
free_ioengine(&td);
|
||||
return ret;
|
||||
--
|
||||
2.17.0
|
||||
|
9
fio.spec
9
fio.spec
@ -1,12 +1,15 @@
|
||||
Name: fio
|
||||
Version: 3.27
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Multithreaded IO generation tool
|
||||
|
||||
License: GPLv2
|
||||
URL: http://git.kernel.dk/?p=fio.git;a=summary
|
||||
Source: http://brick.kernel.dk/snaps/%{name}-%{version}.tar.bz2
|
||||
|
||||
Patch0: 0001-ioengines-fix-crash-with-enghelp-option.patch
|
||||
Patch1: 0001-fio-remove-raw-device-support.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: zlib-devel
|
||||
@ -207,6 +210,10 @@ make install prefix=%{_prefix} mandir=%{_mandir} libdir=%{_libdir}/fio DESTDIR=$
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Aug 05 2021 Eric Sandeen <sandeen@redhat.com> - 3.27-3
|
||||
- Fix crash on --enghelp option
|
||||
- Fix FTBFS with new kernel headers (bz#1984823)
|
||||
|
||||
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.27-2
|
||||
- Rebuilt for RHEL 9 BETA for openssl 3.0
|
||||
Related: rhbz#1971065
|
||||
|
Loading…
Reference in New Issue
Block a user