qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/4] NBD patches through 2020-05-04
@ 2020-05-04 21:14 Eric Blake
  2020-05-04 21:14 ` [PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation Eric Blake
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Eric Blake @ 2020-05-04 21:14 UTC (permalink / raw)
  To: qemu-devel

Happy Star Wars Day! May the Fourth be with you as you apply this...

The following changes since commit 5375af3cd7b8adcc10c18d8083b7be63976c9645:

  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-05-04 15:51:09 +0100)

are available in the Git repository at:

  https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2020-05-04

for you to fetch changes up to 714eb0dbc5480c8a9d9f39eb931cb5d2acc1b6c6:

  block/nbd-client: drop max_block restriction from discard (2020-05-04 15:16:46 -0500)

----------------------------------------------------------------
nbd patches for 2020-05-04

- reduce client-side fragmentation of NBD trim and status requests
- fix iotest 41 when run in deep tree
- fix socket activation in qemu-nbd

----------------------------------------------------------------
Eric Blake (1):
      tools: Fix use of fcntl(F_SETFD) during socket activation

Max Reitz (1):
      iotests/041: Fix NBD socket path

Vladimir Sementsov-Ogievskiy (2):
      block/nbd-client: drop max_block restriction from block_status
      block/nbd-client: drop max_block restriction from discard

 block/nbd.c            | 6 ++----
 util/systemd.c         | 4 +++-
 tests/qemu-iotests/041 | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation
  2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
@ 2020-05-04 21:14 ` Eric Blake
  2020-05-04 21:14 ` [PULL 2/4] iotests/041: Fix NBD socket path Eric Blake
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2020-05-04 21:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

Blindly setting FD_CLOEXEC without a read-modify-write will
inadvertently clear any other intentionally-set bits, such as a
proposed new bit for designating a fd that must behave in 32-bit mode.
However, we cannot use our wrapper qemu_set_cloexec(), because that
wrapper intentionally abort()s on failure, whereas the probe here
intentionally tolerates failure to deal with incorrect socket
activation gracefully.  Instead, fix the code to do the proper
read-modify-write.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200420175309.75894-3-eblake@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 util/systemd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/systemd.c b/util/systemd.c
index 1dd0367d9a84..5bcac9b40169 100644
--- a/util/systemd.c
+++ b/util/systemd.c
@@ -23,6 +23,7 @@ unsigned int check_socket_activation(void)
     unsigned long nr_fds;
     unsigned int i;
     int fd;
+    int f;
     int err;

     s = getenv("LISTEN_PID");
@@ -54,7 +55,8 @@ unsigned int check_socket_activation(void)
     /* So the file descriptors don't leak into child processes. */
     for (i = 0; i < nr_fds; ++i) {
         fd = FIRST_SOCKET_ACTIVATION_FD + i;
-        if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
+        f = fcntl(fd, F_GETFD);
+        if (f == -1 || fcntl(fd, F_SETFD, f | FD_CLOEXEC) == -1) {
             /* If we cannot set FD_CLOEXEC then it probably means the file
              * descriptor is invalid, so socket activation has gone wrong
              * and we should exit.
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] iotests/041: Fix NBD socket path
  2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
  2020-05-04 21:14 ` [PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation Eric Blake
@ 2020-05-04 21:14 ` Eric Blake
  2020-05-04 21:14 ` [PULL 3/4] block/nbd-client: drop max_block restriction from block_status Eric Blake
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2020-05-04 21:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Elena Ufimtseva, Kevin Wolf, open list:Block layer core,
	Stefan Hajnoczi, Max Reitz

From: Max Reitz <mreitz@redhat.com>

We should put all UNIX socket files into the sock_dir, not test_dir.

Reported-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200424134626.78945-1-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Fixes: a1da1878607a
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 tests/qemu-iotests/041 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 5d67bf14bfe8..46bf1f6c8164 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -35,7 +35,7 @@ quorum_img3 = os.path.join(iotests.test_dir, 'quorum3.img')
 quorum_repair_img = os.path.join(iotests.test_dir, 'quorum_repair.img')
 quorum_snapshot_file = os.path.join(iotests.test_dir, 'quorum_snapshot.img')

-nbd_sock_path = os.path.join(iotests.test_dir, 'nbd.sock')
+nbd_sock_path = os.path.join(iotests.sock_dir, 'nbd.sock')

 class TestSingleDrive(iotests.QMPTestCase):
     image_len = 1 * 1024 * 1024 # MB
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] block/nbd-client: drop max_block restriction from block_status
  2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
  2020-05-04 21:14 ` [PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation Eric Blake
  2020-05-04 21:14 ` [PULL 2/4] iotests/041: Fix NBD socket path Eric Blake
@ 2020-05-04 21:14 ` Eric Blake
  2020-05-04 21:14 ` [PULL 4/4] block/nbd-client: drop max_block restriction from discard Eric Blake
  2020-05-05 15:46 ` [PULL 0/4] NBD patches through 2020-05-04 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2020-05-04 21:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy,
	open list:Network Block Dev...,
	Max Reitz

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

The NBD spec was updated (see nbd.git commit 9f30fedb) so that
max_block doesn't relate to NBD_CMD_BLOCK_STATUS. So, drop the
restriction.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200401150112.9557-2-vsementsov@virtuozzo.com>
[eblake: tweak commit message to call out NBD commit]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/nbd.c b/block/nbd.c
index 2160859f6499..d4d518a780c9 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1320,9 +1320,7 @@ static int coroutine_fn nbd_client_co_block_status(
     NBDRequest request = {
         .type = NBD_CMD_BLOCK_STATUS,
         .from = offset,
-        .len = MIN(MIN_NON_ZERO(QEMU_ALIGN_DOWN(INT_MAX,
-                                                bs->bl.request_alignment),
-                                s->info.max_block),
+        .len = MIN(QEMU_ALIGN_DOWN(INT_MAX, bs->bl.request_alignment),
                    MIN(bytes, s->info.size - offset)),
         .flags = NBD_CMD_FLAG_REQ_ONE,
     };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] block/nbd-client: drop max_block restriction from discard
  2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
                   ` (2 preceding siblings ...)
  2020-05-04 21:14 ` [PULL 3/4] block/nbd-client: drop max_block restriction from block_status Eric Blake
@ 2020-05-04 21:14 ` Eric Blake
  2020-05-05 15:46 ` [PULL 0/4] NBD patches through 2020-05-04 Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2020-05-04 21:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy,
	open list:Network Block Dev...,
	Max Reitz

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

The NBD spec was updated (see nbd.git commit 9f30fedb) so that
max_block doesn't relate to NBD_CMD_TRIM. So, drop the restriction.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200401150112.9557-3-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: tweak commit message to call out NBD commit]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/nbd.c b/block/nbd.c
index d4d518a780c9..4ac23c8f6299 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1955,7 +1955,7 @@ static void nbd_refresh_limits(BlockDriverState *bs, Error **errp)
     }

     bs->bl.request_alignment = min;
-    bs->bl.max_pdiscard = max;
+    bs->bl.max_pdiscard = QEMU_ALIGN_DOWN(INT_MAX, min);
     bs->bl.max_pwrite_zeroes = max;
     bs->bl.max_transfer = max;

-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] NBD patches through 2020-05-04
  2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
                   ` (3 preceding siblings ...)
  2020-05-04 21:14 ` [PULL 4/4] block/nbd-client: drop max_block restriction from discard Eric Blake
@ 2020-05-05 15:46 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2020-05-05 15:46 UTC (permalink / raw)
  To: Eric Blake; +Cc: QEMU Developers

On Mon, 4 May 2020 at 22:21, Eric Blake <eblake@redhat.com> wrote:
>
> Happy Star Wars Day! May the Fourth be with you as you apply this...
>
> The following changes since commit 5375af3cd7b8adcc10c18d8083b7be63976c9645:
>
>   Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-05-04 15:51:09 +0100)
>
> are available in the Git repository at:
>
>   https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2020-05-04
>
> for you to fetch changes up to 714eb0dbc5480c8a9d9f39eb931cb5d2acc1b6c6:
>
>   block/nbd-client: drop max_block restriction from discard (2020-05-04 15:16:46 -0500)
>
> ----------------------------------------------------------------
> nbd patches for 2020-05-04
>
> - reduce client-side fragmentation of NBD trim and status requests
> - fix iotest 41 when run in deep tree
> - fix socket activation in qemu-nbd
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-05 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 21:14 [PULL 0/4] NBD patches through 2020-05-04 Eric Blake
2020-05-04 21:14 ` [PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation Eric Blake
2020-05-04 21:14 ` [PULL 2/4] iotests/041: Fix NBD socket path Eric Blake
2020-05-04 21:14 ` [PULL 3/4] block/nbd-client: drop max_block restriction from block_status Eric Blake
2020-05-04 21:14 ` [PULL 4/4] block/nbd-client: drop max_block restriction from discard Eric Blake
2020-05-05 15:46 ` [PULL 0/4] NBD patches through 2020-05-04 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).