NBD patches through 2020-05-04
[PULL 2/4] iotests/041: Fix NBD socket path
In reply to Eric BlakeFrom: Max Reitz <[email protected]>
We should put all UNIX socket files into the sock_dir, not test_dir.
Message-Id: <[email protected]>
--- tests/qemu-iotests/041 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/041 +1 -1
@@ -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
Signature · 1 line
2.26.2
[PULL 3/4] block/nbd-client: drop max_block restriction from block_status
In reply to Eric BlakeFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
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.
Message-Id: <[email protected]>
--- block/nbd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/nbd.c +1 -3
@@ -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 , };
Signature · 1 line
2.26.2
[PULL 1/4] tools: Fix use of fcntl(F_SETFD) during socket activation
In reply to Eric BlakeBlindly 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.
Message-Id: <[email protected]>
--- util/systemd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
util/systemd.c +3 -1
@@ -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.
Signature · 1 line
2.26.2
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(-)
Signature · 1 line
2.26.2
[PULL 4/4] block/nbd-client: drop max_block restriction from discard
From: Vladimir Sementsov-Ogievskiy <[email protected]>
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.
Message-Id: <[email protected]>
--- block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/nbd.c +1 -1
@@ -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;
Signature · 1 line
2.26.2
Peter Maydell
AppliedQuoted 13 lines · Eric Blake
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:
Quoted 9 lines
block/nbd-client: dropmax_blockrestriction 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