New upstream development version 1.15.9

This commit is contained in:
Richard W.M. Jones 2023-01-21 22:39:06 +00:00
parent 89aee3bed6
commit a34fe5827e
3 changed files with 6 additions and 255 deletions

View File

@ -1,192 +0,0 @@
From 7a402ab853f480245767d72ae2f61e880893ea4d Mon Sep 17 00:00:00 2001
From: Ming Lei <ming.lei@redhat.com>
Date: Fri, 9 Dec 2022 13:45:01 +0000
Subject: [PATCH 1/2] ublk: Update for ubdsrv changing API
See:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/NKQKUCUOHDCVVSR2PXVANGZSBXXPHYLY/
---
ublk/nbdublk.c | 7 +++++--
ublk/tgt.c | 42 +++++++++++++++++++++++-------------------
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/ublk/nbdublk.c b/ublk/nbdublk.c
index 53af840f7a..00aa23ec03 100644
--- a/ublk/nbdublk.c
+++ b/ublk/nbdublk.c
@@ -166,6 +166,7 @@ main (int argc, char *argv[])
uint64_t max_block_size;
const char *s;
struct ublksrv_dev_data data = { .dev_id = -1 };
+ const struct ublksrv_ctrl_dev_info *dinfo;
struct sigaction sa = { 0 };
for (;;) {
@@ -420,6 +421,8 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
+ dinfo = ublksrv_ctrl_get_dev_info(dev);
+
/* Register signal handlers to try to stop the device. */
sa.sa_handler = signal_handler;
sigaction (SIGHUP, &sa, NULL);
@@ -432,14 +435,14 @@ main (int argc, char *argv[])
if (r < 0) {
errno = -r;
fprintf (stderr, "%s: ublksrv_ctrl_add_dev: "DEVICE_PREFIX "%d: %m\n",
- argv[0], dev->dev_info.dev_id);
+ argv[0], dinfo->dev_id);
ublksrv_ctrl_deinit (dev);
exit (EXIT_FAILURE);
}
if (verbose)
fprintf (stderr, "%s: created %s%d\n",
- argv[0], DEVICE_PREFIX, dev->dev_info.dev_id);
+ argv[0], DEVICE_PREFIX, dinfo->dev_id);
/* XXX nbdfuse creates a pid file. However I reason that you can
* tell if the service is available when the block device is created
diff --git a/ublk/tgt.c b/ublk/tgt.c
index e25e072875..3fb2223331 100644
--- a/ublk/tgt.c
+++ b/ublk/tgt.c
@@ -33,6 +33,7 @@
#define _Atomic /**/
#endif
+#include <limits.h>
#include <ublksrv.h>
#include <ublksrv_aio.h>
@@ -53,7 +54,7 @@
* The thread_info entry is shared between each pair of threads.
*/
struct thread_info {
- struct ublksrv_dev *dev;
+ const struct ublksrv_dev *dev;
size_t i; /* index into nbd.ptr[], also q_id */
pthread_t io_uring_thread;
pthread_t nbd_work_thread;
@@ -208,7 +209,7 @@ nbd_work_thread (void *vpinfo)
ublksrv_aio_complete_worker (aio_ctx, &compl);
- if (nbd_poll2 (h, aio_ctx->efd, -1) == -1) {
+ if (nbd_poll2 (h, ublksrv_aio_get_efd(aio_ctx), -1) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
@@ -221,15 +222,17 @@ static void *
io_uring_thread (void *vpinfo)
{
struct thread_info *thread_info = vpinfo;
- struct ublksrv_dev *dev = thread_info->dev;
- const unsigned dev_id = dev->ctrl_dev->dev_info.dev_id;
+ const struct ublksrv_dev *dev = thread_info->dev;
+ const struct ublksrv_ctrl_dev *cdev = ublksrv_get_ctrl_dev(dev);
+ const struct ublksrv_ctrl_dev_info *dinfo = ublksrv_ctrl_get_dev_info(cdev);
+ const unsigned dev_id = dinfo->dev_id;
const size_t q_id = thread_info->i;
- struct ublksrv_queue *q;
+ const struct ublksrv_queue *q;
int r;
+ int tid = gettid();
pthread_mutex_lock (&jbuf_lock);
- ublksrv_json_write_queue_info (dev->ctrl_dev, jbuf, sizeof jbuf,
- q_id, gettid ());
+ ublksrv_json_write_queue_info (cdev, jbuf, sizeof jbuf, q_id, tid);
pthread_mutex_unlock (&jbuf_lock);
q = ublksrv_queue_init (dev, q_id, NULL);
@@ -240,7 +243,7 @@ io_uring_thread (void *vpinfo)
if (verbose)
fprintf (stderr, "%s: ublk tid %d dev %d queue %d started\n",
- "nbdublk", q->tid, dev_id, q->q_id);
+ "nbdublk", tid, dev_id, q->q_id);
for (;;) {
r = ublksrv_process_io (q);
@@ -255,7 +258,7 @@ io_uring_thread (void *vpinfo)
if (verbose)
fprintf (stderr, "%s: ublk tid %d dev %d queue %d exited\n",
- "nbdublk", q->tid, dev_id, q->q_id);
+ "nbdublk", tid, dev_id, q->q_id);
ublksrv_queue_deinit (q);
return NULL;
@@ -265,7 +268,7 @@ static int
set_parameters (struct ublksrv_ctrl_dev *ctrl_dev,
const struct ublksrv_dev *dev)
{
- struct ublksrv_ctrl_dev_info *dinfo = &ctrl_dev->dev_info;
+ const struct ublksrv_ctrl_dev_info *dinfo = ublksrv_ctrl_get_dev_info(ctrl_dev);
const unsigned attrs =
(readonly ? UBLK_ATTR_READ_ONLY : 0) |
(rotational ? UBLK_ATTR_ROTATIONAL : 0) |
@@ -305,8 +308,8 @@ set_parameters (struct ublksrv_ctrl_dev *ctrl_dev,
int
start_daemon (struct ublksrv_ctrl_dev *ctrl_dev)
{
- const struct ublksrv_ctrl_dev_info *dinfo = &ctrl_dev->dev_info;
- struct ublksrv_dev *dev;
+ const struct ublksrv_ctrl_dev_info *dinfo = ublksrv_ctrl_get_dev_info(ctrl_dev);
+ const struct ublksrv_dev *dev;
size_t i;
int r;
@@ -418,7 +421,8 @@ start_daemon (struct ublksrv_ctrl_dev *ctrl_dev)
static int
init_tgt (struct ublksrv_dev *dev, int type, int argc, char *argv[])
{
- const struct ublksrv_ctrl_dev_info *info = &dev->ctrl_dev->dev_info;
+ const struct ublksrv_ctrl_dev *cdev = ublksrv_get_ctrl_dev(dev);
+ const struct ublksrv_ctrl_dev_info *info = ublksrv_ctrl_get_dev_info(cdev);
struct ublksrv_tgt_info *tgt = &dev->tgt;
struct ublksrv_tgt_base_json tgt_json = {
.type = type,
@@ -435,14 +439,14 @@ init_tgt (struct ublksrv_dev *dev, int type, int argc, char *argv[])
tgt->tgt_ring_depth = info->queue_depth;
tgt->nr_fds = 0;
- ublksrv_json_write_dev_info (dev->ctrl_dev, jbuf, sizeof jbuf);
+ ublksrv_json_write_dev_info (ublksrv_get_ctrl_dev(dev), jbuf, sizeof jbuf);
ublksrv_json_write_target_base_info (jbuf, sizeof jbuf, &tgt_json);
return 0;
}
static void
-handle_event (struct ublksrv_queue *q)
+handle_event (const struct ublksrv_queue *q)
{
struct ublksrv_aio_ctx *aio_ctx = thread_info.ptr[q->q_id].aio_ctx;
@@ -454,16 +458,16 @@ handle_event (struct ublksrv_queue *q)
}
static int
-handle_io_async (struct ublksrv_queue *q, int tag)
+handle_io_async (const struct ublksrv_queue *q, const struct ublk_io_data *io)
{
struct ublksrv_aio_ctx *aio_ctx = thread_info.ptr[q->q_id].aio_ctx;
- const struct ublksrv_io_desc *iod = ublksrv_get_iod (q, tag);
+ const struct ublksrv_io_desc *iod = io->iod;
struct ublksrv_aio *req = ublksrv_aio_alloc_req (aio_ctx, 0);
req->io = *iod;
- req->id = ublksrv_aio_pid_tag (q->q_id, tag);
+ req->id = ublksrv_aio_pid_tag (q->q_id, io->tag);
if (verbose)
- fprintf (stderr, "%s: qid %d tag %d\n", "nbdublk", q->q_id, tag);
+ fprintf (stderr, "%s: qid %d tag %d\n", "nbdublk", q->q_id, io->tag);
ublksrv_aio_submit_req (aio_ctx, q, req);
return 0;
--
2.37.3

View File

@ -1,54 +0,0 @@
From 8c802dd9459f695ab2195f7b29fbe71c65c33a81 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 18 Oct 2022 10:55:22 +0100
Subject: [PATCH 2/2] build: Replace Python distutils by sysconfig
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This module has been deprecated in Python >= 3.10
(https://peps.python.org/pep-0632/). Replace distutils.sysconfig with
sysconfig which is not quite a drop-in replacement.
This fix is incomplete as we still reference distutils in
python/setup.py.in. However that is only used for PIP-style
distributions (make -C python sdist) which we don't really use or
recommend.
Thanks: Miro Hrončok
See-also: https://peps.python.org/pep-0632/
See-also: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/N6ITYHLRWIDNYNXGPYG2ZHF3ZLQWZN7L/
Cherry picked from libguestfs commit 26940f64a7406761
---
configure.ac | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3a09816af7..5f0ca6994d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -549,16 +549,16 @@ AS_IF([test "x$enable_python" != "xno"],[
PYTHON_INSTALLDIR=
AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_INSTALLDIR"; then
- PYTHON_INSTALLDIR=`$PYTHON -c "import distutils.sysconfig; \
- print (distutils.sysconfig.get_python_lib(1,0));"`
+ PYTHON_INSTALLDIR=`$PYTHON -c "import sysconfig; \
+ print (sysconfig.get_path('platlib'));"`
fi
AC_MSG_RESULT([$PYTHON_INSTALLDIR])
fi
AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
if test -z "$PYTHON_EXT_SUFFIX"; then
- python_ext_suffix=`$PYTHON -c "import distutils.sysconfig; \
- print (distutils.sysconfig.get_config_var('EXT_SUFFIX') or distutils.sysconfig.get_config_var('SO'))"`
+ python_ext_suffix=`$PYTHON -c "import sysconfig; \
+ print (sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"`
PYTHON_EXT_SUFFIX=$python_ext_suffix
fi
AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
--
2.37.3

View File

@ -5,14 +5,14 @@
%global verify_tarball_signature 1
# If there are patches which touch autotools files, set this to 1.
%global patches_touch_autotools 1
%global patches_touch_autotools %{nil}
# The source directory.
%global source_directory 1.15-development
Name: libnbd
Version: 1.15.8
Release: 4%{?dist}
Version: 1.15.9
Release: 1%{?dist}
Summary: NBD client library in userspace
License: LGPLv2+
@ -28,12 +28,6 @@ Source2: libguestfs.keyring
# Maintainer script which helps with handling patches.
Source3: copy-patches.sh
# Upstream fix for changed ubdsrv API.
Patch: 0001-ublk-Update-for-ubdsrv-changing-API.patch
# Upstream Python change (RHBZ#2152674).
Patch: 0002-build-Replace-Python-distutils-by-sysconfig.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -352,6 +346,9 @@ make %{?_smp_mflags} check || {
%changelog
* Sat Jan 21 2023 Richard W.M. Jones <rjones@redhat.com> - 1.15.9-1
- New upstream development version 1.15.9
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild