[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 44/71] block/nfs: Implement bdrv_dirname()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 44/71] block/nfs: Implement bdrv_dirname() |
Date: |
Mon, 25 Feb 2019 16:20:26 +0100 |
From: Max Reitz <address@hidden>
While the basic idea is obvious and could be handled by the default
bdrv_dirname() implementation, we cannot generate a directory name if
the gid or uid are set, so we have to explicitly return NULL in those
cases.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/nfs.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/block/nfs.c b/block/nfs.c
index eab1a2c408..19ee07c321 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -855,6 +855,20 @@ static void nfs_refresh_filename(BlockDriverState *bs,
QDict *options)
bs->full_open_options = opts;
}
+static char *nfs_dirname(BlockDriverState *bs, Error **errp)
+{
+ NFSClient *client = bs->opaque;
+
+ if (client->uid || client->gid) {
+ bdrv_refresh_filename(bs);
+ error_setg(errp, "Cannot generate a base directory for NFS node '%s'",
+ bs->filename);
+ return NULL;
+ }
+
+ return g_strdup_printf("nfs://%s%s/", client->server->host, client->path);
+}
+
#ifdef LIBNFS_FEATURE_PAGECACHE
static void coroutine_fn nfs_co_invalidate_cache(BlockDriverState *bs,
Error **errp)
@@ -889,6 +903,7 @@ static BlockDriver bdrv_nfs = {
.bdrv_detach_aio_context = nfs_detach_aio_context,
.bdrv_attach_aio_context = nfs_attach_aio_context,
.bdrv_refresh_filename = nfs_refresh_filename,
+ .bdrv_dirname = nfs_dirname,
#ifdef LIBNFS_FEATURE_PAGECACHE
.bdrv_co_invalidate_cache = nfs_co_invalidate_cache,
--
2.20.1
- [Qemu-block] [PULL 42/71] quorum: Make bdrv_dirname() return NULL, (continued)
- [Qemu-block] [PULL 42/71] quorum: Make bdrv_dirname() return NULL, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 34/71] iotests: Add test for backing file overrides, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 41/71] blkverify: Make bdrv_dirname() return NULL, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 26/71] block/nvme: Remove QEMU_PACKED from naturally aligned NVMeRegs struct, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 40/71] block: Add bdrv_dirname(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 30/71] block: Add BDS.auto_backing_file, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 43/71] block/nbd: Make bdrv_dirname() return NULL, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 31/71] block: Respect backing bs in bdrv_refresh_filename, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 27/71] block: Use bdrv_refresh_filename() to pull, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 39/71] block: Fix bdrv_find_backing_image(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 44/71] block/nfs: Implement bdrv_dirname(),
Kevin Wolf <=
- [Qemu-block] [PULL 45/71] block: Use bdrv_dirname() for relative filenames, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 47/71] block: Add strong_runtime_opts to BlockDriver, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 46/71] iotests: Add quorum case to test 110, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 51/71] block: Do not copy exact_filename from format file, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 48/71] block: Add BlockDriver.bdrv_gather_child_options, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 49/71] block: Generically refresh runtime options, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 52/71] block/nvme: Fix bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 54/71] block/curl: Implement bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 50/71] block: Purify .bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 55/71] block/null: Generate filename even with latency-ns, Kevin Wolf, 2019/02/25