Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-133323

[RHEL10] device-mapper: reload ioctl on integrity_resize_test_305948 failed: Invalid argument

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-10.2
    • cryptsetup
    • None
    • None
    • None
    • rhel-storage-crs
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      dm-integrity Bitmap Mode Resize exit code is 1 and output was device-mapper: reload ioctl on integrity_resize_test_305948  failed: Invalid argument

      but Device size INCREASED (resize actually worked).

      === Step 1: Device Setup ===
      Device: /dev/nvme0n1p1
      Total size: 10485760 sectors
      Block size: 4096 bytes (8 sectors)
      
      
      === Step 2: Create Linear Device (80% of capacity) ===
      Creating linear device: 8388608 sectors
      ✓ Linear device created: /dev/mapper/linear_resize_test_305948=== 
      
      
      Step 3: Format with dm-integrity Bitmap Mode ===
      ✓ Device formatted with bitmap mode
      
      
      === Step 4: Open dm-integrity Device ===
      ✓ Device opened: /dev/mapper/integrity_resize_test_305948
      
      
      === Step 5: Check Initial Size ===
      dm-integrity size: 8258360 sectors (~4032MB)
      0 8258360 integrity 253:3 0 4 B 7 interleave_sectors:32768 buffer_sectors:128 sectors_per_bit:32768 bitmap_flush_interval:10000 fix_padding fix_hmac internal_hash:crc32c
      
      
      === Step 6: Close Device ===
      ✓ Device closed=== 
      
      
      Step 7: Resize Linear Device (80% → 95%) ===
      Resizing linear device: 8388608 → 9961472 sectors
      Increase: 1572864 sectors (~768MB)
      ✓ Linear device resized
      
      
      === Step 8: Reopen dm-integrity Device ===
      dm-integrity size after reopen: 8258360 sectors
      ⚠ Size unchanged - device did NOT auto-resize on reopen
      
      === Step 9: Resize dm-integrity Device ===
      Command: integritysetup resize integrity_resize_test_305948 --device-size 0
      
      --- Output ---
      device-mapper: reload ioctl on integrity_resize_test_305948  failed: Invalid argument
      --------------
      
      
      === Step 10: Results ===
      Exit code: 1Size before resize: 8258360 sectors
      Size after resize:  9819192 sectors
      Actual increase:    1560832 sectors (~762MB)
      
      
      === Analysis ===
      ❌ Exit code is 1 (FAILURE)
      ✓ Device size INCREASED (resize actually worked)
       

       

      [root@storageqe-109 libblockdev]# cat reproduce_bitmap_resize_issue.sh
      #!/bin/bash
      # Reproduce dm-integrity bitmap mode resize issue
      # This script demonstrates that integritysetup resize returns exit code 1
      # even though the resize operation actually succeedsset -eDEVICE="/dev/nvme0n1p1"
      LINEAR_NAME="linear_resize_test_$$"
      DM_NAME="integrity_resize_test_$$"echo "========================================"
      echo "dm-integrity Bitmap Mode Resize Issue"
      echo "========================================"
      echo ""cleanup() {
          echo ""
          echo "=== Cleanup ==="
          integritysetup close $DM_NAME 2>/dev/null || true
          dmsetup remove $LINEAR_NAME 2>/dev/null || true
          echo "Cleanup complete"
      }
      trap cleanup EXIT# Get device information
      echo "=== Step 1: Device Setup ==="
      FULL_SIZE=$(blockdev --getsz $DEVICE)
      BLOCK_SIZE=$(blockdev --getpbsz $DEVICE)
      SECTORS_PER_BLOCK=$((BLOCK_SIZE / 512))
      echo "Device: $DEVICE"
      echo "Total size: $FULL_SIZE sectors"
      echo "Block size: $BLOCK_SIZE bytes ($SECTORS_PER_BLOCK sectors)"
      echo ""# Create linear device at 80% capacity
      echo "=== Step 2: Create Linear Device (80% of capacity) ==="
      INITIAL_SIZE=$((FULL_SIZE * 80 / 100 / SECTORS_PER_BLOCK * SECTORS_PER_BLOCK))
      echo "Creating linear device: $INITIAL_SIZE sectors"
      echo "0 $INITIAL_SIZE linear $DEVICE 0" | dmsetup create $LINEAR_NAME
      LINEAR_DEV="/dev/mapper/$LINEAR_NAME"
      echo "✓ Linear device created: $LINEAR_DEV"
      echo ""# Format with bitmap mode
      echo "=== Step 3: Format with dm-integrity Bitmap Mode ==="
      integritysetup format --integrity crc32c --integrity-bitmap-mode -q $LINEAR_DEV
      echo "✓ Device formatted with bitmap mode"
      echo ""# Open device
      echo "=== Step 4: Open dm-integrity Device ==="
      integritysetup open --integrity-bitmap-mode $LINEAR_DEV $DM_NAME -q
      DM_DEV="/dev/mapper/$DM_NAME"
      echo "✓ Device opened: $DM_DEV"
      echo ""# Get initial size
      echo "=== Step 5: Check Initial Size ==="
      INITIAL_DM_SIZE=$(dmsetup table $DM_NAME | awk '{print $2}')
      INITIAL_DM_SIZE_MB=$((INITIAL_DM_SIZE * 512 / 1024 / 1024))
      echo "dm-integrity size: $INITIAL_DM_SIZE sectors (~${INITIAL_DM_SIZE_MB}MB)"
      dmsetup table $DM_NAME
      echo ""# Close device before resizing underlying linear device
      echo "=== Step 6: Close Device ==="
      integritysetup close $DM_NAME
      echo "✓ Device closed"
      echo ""# Resize linear device to 95%
      echo "=== Step 7: Resize Linear Device (80% → 95%) ==="
      NEW_LINEAR_SIZE=$((FULL_SIZE * 95 / 100 / SECTORS_PER_BLOCK * SECTORS_PER_BLOCK))
      SIZE_INCREASE=$((NEW_LINEAR_SIZE - INITIAL_SIZE))
      SIZE_INCREASE_MB=$((SIZE_INCREASE * 512 / 1024 / 1024))
      echo "Resizing linear device: $INITIAL_SIZE → $NEW_LINEAR_SIZE sectors"
      echo "Increase: $SIZE_INCREASE sectors (~${SIZE_INCREASE_MB}MB)"dmsetup suspend $LINEAR_NAME
      echo "0 $NEW_LINEAR_SIZE linear $DEVICE 0" | dmsetup reload $LINEAR_NAME
      dmsetup resume $LINEAR_NAME
      echo "✓ Linear device resized"
      echo ""# Reopen dm-integrity device
      echo "=== Step 8: Reopen dm-integrity Device ==="
      integritysetup open --integrity-bitmap-mode $LINEAR_DEV $DM_NAME -q
      AFTER_REOPEN_SIZE=$(dmsetup table $DM_NAME | awk '{print $2}')
      echo "dm-integrity size after reopen: $AFTER_REOPEN_SIZE sectors"if [ $AFTER_REOPEN_SIZE -eq $INITIAL_DM_SIZE ]; then
          echo "⚠ Size unchanged - device did NOT auto-resize on reopen"
      else
          echo "✓ Size changed - device auto-resized on reopen"
      fi
      echo ""# The critical test: integritysetup resize
      echo "=== Step 9: Resize dm-integrity Device ==="
      echo "Command: integritysetup resize $DM_NAME --device-size 0"
      echo ""# Run resize and capture output and exit code
      set +e
      RESIZE_OUTPUT=$(integritysetup resize $DM_NAME --device-size 0 2>&1)
      RESIZE_EXITCODE=$?
      set -eecho "--- Output ---"
      echo "$RESIZE_OUTPUT"
      echo "--------------"
      echo ""# Get size after resize
      AFTER_RESIZE_SIZE=$(dmsetup table $DM_NAME | awk '{print $2}')
      ACTUAL_INCREASE=$((AFTER_RESIZE_SIZE - INITIAL_DM_SIZE))
      ACTUAL_INCREASE_MB=$((ACTUAL_INCREASE * 512 / 1024 / 1024))echo "=== Step 10: Results ==="
      echo "Exit code: $RESIZE_EXITCODE"
      echo ""
      echo "Size before resize: $INITIAL_DM_SIZE sectors"
      echo "Size after resize:  $AFTER_RESIZE_SIZE sectors"
      echo "Actual increase:    $ACTUAL_INCREASE sectors (~${ACTUAL_INCREASE_MB}MB)"
      echo ""# Analyze results
      echo "=== Analysis ==="
      if [ $RESIZE_EXITCODE -ne 0 ]; then
          echo "❌ Exit code is $RESIZE_EXITCODE (FAILURE)"
      else
          echo "✓ Exit code is 0 (SUCCESS)"
      fiif [ $AFTER_RESIZE_SIZE -gt $INITIAL_DM_SIZE ]; then
          echo "✓ Device size INCREASED (resize actually worked)"
      else
          echo "❌ Device size UNCHANGED (resize did not work)"
      fiecho ""
      echo "=== Conclusion ==="
      if [ $RESIZE_EXITCODE -ne 0 ] && [ $AFTER_RESIZE_SIZE -gt $INITIAL_DM_SIZE ]; then
          echo "🐛 BUG REPRODUCED!"
          echo ""
          echo "The resize command returns exit code $RESIZE_EXITCODE (failure)"
          echo "BUT the device size actually increased by $ACTUAL_INCREASE sectors"
          echo ""
          echo "This is a known issue with dm-integrity bitmap mode resize:"
          echo "- The operation partially succeeds (device grows)"
          echo "- But the command still returns non-zero exit code"
          echo "- Error message: '$RESIZE_OUTPUT'"
          echo ""
          echo "This causes test failures when checking exit codes,"
          echo "even though the resize operation actually works."
      elif [ $RESIZE_EXITCODE -eq 0 ] && [ $AFTER_RESIZE_SIZE -gt $INITIAL_DM_SIZE ]; then
          echo "✓ Resize worked correctly (exit code 0, size increased)"
      elif [ $RESIZE_EXITCODE -ne 0 ] && [ $AFTER_RESIZE_SIZE -eq $INITIAL_DM_SIZE ]; then
          echo "❌ Resize completely failed (exit code non-zero, size unchanged)"
      else
          echo "⚠ Unexpected result - please investigate"
      ficleanup
       

       

      6.12.0-157.el10.x86_64

      cryptsetup-2.8.1-1.el10.x86_64

              okozina@redhat.com Ondrej Kozina
              guazhang@redhat.com Guangwu Zhang
              Ondrej Kozina Ondrej Kozina
              Guangwu Zhang Guangwu Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: