[libvirt] [PATCH] storage: Fix iscsi-direct volume size for volumes > 4GiB

Jiri Denemark posted 1 patch 5 years, 1 month ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/13a14a69663e89354628222596635f3d566b9bd3.1551363720.git.jdenemar@redhat.com
There is a newer version of this series
src/storage/storage_backend_iscsi_direct.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] storage: Fix iscsi-direct volume size for volumes > 4GiB
Posted by Jiri Denemark 5 years, 1 month ago
Both block_size and nb_block are unit32_t.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/storage/storage_backend_iscsi_direct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
index 20997d5c5d..78dc4bd100 100644
--- a/src/storage/storage_backend_iscsi_direct.c
+++ b/src/storage/storage_backend_iscsi_direct.c
@@ -321,8 +321,8 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool,
     if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block) < 0)
         return -1;
 
-    vol->target.capacity = block_size * nb_block;
-    vol->target.allocation = block_size * nb_block;
+    vol->target.capacity = (unsigned long long)block_size * nb_block;
+    vol->target.allocation = (unsigned long long)block_size * nb_block;
     def->capacity += vol->target.capacity;
     def->allocation += vol->target.allocation;
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] storage: Fix iscsi-direct volume size for volumes > 4GiB
Posted by Jiri Denemark 5 years, 1 month ago
On Thu, Feb 28, 2019 at 15:22:00 +0100, Jiri Denemark wrote:
> Both block_size and nb_block are unit32_t.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/storage/storage_backend_iscsi_direct.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
> index 20997d5c5d..78dc4bd100 100644
> --- a/src/storage/storage_backend_iscsi_direct.c
> +++ b/src/storage/storage_backend_iscsi_direct.c
> @@ -321,8 +321,8 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool,
>      if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block) < 0)
>          return -1;
>  
> -    vol->target.capacity = block_size * nb_block;
> -    vol->target.allocation = block_size * nb_block;
> +    vol->target.capacity = (unsigned long long)block_size * nb_block;
> +    vol->target.allocation = (unsigned long long)block_size * nb_block;
>      def->capacity += vol->target.capacity;
>      def->allocation += vol->target.allocation;

Self-NACK. We need a little bit more invasive approach to also support
volumes larger than 2TiB (with 512B block size).

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list