diff options
author | Brian Foster <bfoster@redhat.com> | 2013-10-02 07:15:44 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-10-09 18:57:18 -0700 |
commit | 19ae2464c0800965c18c35132b0b6c7fe09d5f68 (patch) | |
tree | f5e520cce48f63c73d4773aa3c1d62ab91c8facb /xlators/features/qemu-block | |
parent | ce9a704361c0a3638e46911eb5275c02e6a5d9ab (diff) |
features/qemu-block: invoke bdrv_init() only once
bdrv_init() is intended to be invoked only once. If invoked again
after initialization (i.e., due to graph changes), the block driver
registration code can reinsert entries into bdrv_drivers,
effectively corrupting the NULL terminated linked list. This
manifests as an infinite loop for callers attempt to traverse the
list (to locate a driver).
BUG: 986775
Change-Id: I2f95bda3c753dece4648cdad009d0e2a2d16f644
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6021
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/qemu-block')
-rw-r--r-- | xlators/features/qemu-block/src/qemu-block.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xlators/features/qemu-block/src/qemu-block.c b/xlators/features/qemu-block/src/qemu-block.c index 81afb95e169..416ae44383c 100644 --- a/xlators/features/qemu-block/src/qemu-block.c +++ b/xlators/features/qemu-block/src/qemu-block.c @@ -982,6 +982,7 @@ init (xlator_t *this) { qb_conf_t *conf = NULL; int32_t ret = -1; + static int bdrv_inited = 0; if (!this->children || this->children->next) { gf_log (this->name, GF_LOG_ERROR, @@ -1018,7 +1019,10 @@ init (xlator_t *this) cur_mon = (void *) 1; - bdrv_init (); + if (!bdrv_inited) { + bdrv_init (); + bdrv_inited = 1; + } out: if (ret) |