Turns out it's unrelated to bcache; it is trivially reproducible:

lxc launch ubuntu-daily:groovy g1 --vm 
lxc exec g1 bash
fallocate -l 1024M /swap.img
mkswap /swap.img
swapon --verbose /swap.img
cat /proc/swaps

On the 5.4 kernel that groovy had a few weeks back this works, on daily
(5.8) this fails:

root@g2vm:/home/ubuntu# uname -r
5.8.0-18-generic
root@g2vm:/home/ubuntu# fallocate -l 1024M /swap.img 
root@g2vm:/home/ubuntu# mkswap /swap.img
mkswap: /swap.img: insecure permissions 0644, 0600 suggested.
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=dafabd56-1137-459c-8e61-b6335eac1d1a
root@g2vm:/home/ubuntu# swapon --verbose /swap.img
swapon: /swap.img: insecure permissions 0644, 0600 suggested.
swapon: /swap.img: found signature [pagesize=4096, signature=swap]
swapon: /swap.img: pagesize=4096, swapsize=1073741824, devsize=1073741824
swapon /swap.img
swapon: /swap.img: swapon failed: Invalid argument
root@g2vm:/home/ubuntu# cat /proc/swaps 
Filename                                Type            Size            Used    
        Priority
root@g2vm:/home/ubuntu# dmesg | tail -n 2
[    7.778887] EXT4-fs (sda1): resized filesystem to 2412985
[   32.766796] swapon: swapfile has holes


Here's groovy from a few weeks back

root@g1fat:/home/ubuntu# cat /etc/cloud/build.info 
build_name: server
serial: 20200819.1
root@g1fat:/home/ubuntu# uname -r
5.4.0-42-generic
root@g1fat:/home/ubuntu# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
root@g1fat:/home/ubuntu# fallocate -l 1024M /swap.img 
root@g1fat:/home/ubuntu# mkswap /swap.img 
mkswap: /swap.img: insecure permissions 0644, 0600 suggested.
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=aef79113-dd6b-4029-b558-f5269150d853
root@g1fat:/home/ubuntu# swapon --verbose /swap.img 
swapon: /swap.img: insecure permissions 0644, 0600 suggested.
swapon: /swap.img: found signature [pagesize=4096, signature=swap]
swapon: /swap.img: pagesize=4096, swapsize=1073741824, devsize=1073741824
swapon /swap.img
root@g1fat:/home/ubuntu# dmesg | tail -n 2
[431543.292314] Adding 1048572k swap on /swap.img.  Priority:-2 extents:5 
across:1187840k FS
root@g1fat:/home/ubuntu# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/swap.img                               file            1048572 0       -2

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1894910

Title:
  fallocate swapfile has holes on 5.8 ext4

Status in linux package in Ubuntu:
  Confirmed

Bug description:
  1) Groovy
  2)
  root@ubuntu:/home/ubuntu# apt-cache policy linux-image-generic
  linux-image-generic:
    Installed: 5.8.0.18.22
    Candidate: 5.8.0.18.22
    Version table:
   *** 5.8.0.18.22 500
          500 http://archive.ubuntu.com/ubuntu groovy/main amd64 Packages
          100 /var/lib/dpkg/status
  3) swapon --verbose /swap.img enables swap file successfully
  4) swapon returns error, says swapfile has holes.

  ----
  Curtin creates file-based swap files with fallocate:

  fallocate -l XXXM /swap.img

  When booting Groovy (5.8 kernel), the swapfile fails to load,
  complains it has holes

  root@ubuntu:/home/ubuntu# swapon --verbose /swap.img
  swapon: /swap.img: found signature [pagesize=4096, signature=swap]
  swapon: /swap.img: pagesize=4096, swapsize=1251999744, devsize=1251999744
  swapon /swap.img
  [  178.283022] swapon: swapfile has holes
  swapon: /swap.img: swapon failed: Invalid argument
  root@ubuntu:/home/ubuntu# uname -r
  5.8.0-18-generic

  This configuration works fine on Focal (5.4) and older.  Previous
  Groovy kernels, (5.7) also worked.

  It may be related to:

  https://lkml.org/lkml/2020/9/4/259

  ProblemType: Bug
  DistroRelease: Ubuntu 20.10
  Package: linux-image-generic 5.8.0.18.22
  ProcVersionSignature: Ubuntu 5.8.0-18.19-generic 5.8.4
  Uname: Linux 5.8.0-18-generic x86_64
  AlsaDevices:
   total 0
   crw-rw---- 1 root audio 116,  1 Sep  8 21:38 seq
   crw-rw---- 1 root audio 116, 33 Sep  8 21:38 timer
  AplayDevices: Error: [Errno 2] No such file or directory: 'aplay'
  ApportVersion: 2.20.11-0ubuntu44
  Architecture: amd64
  ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord'
  AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', 
'/dev/snd/timer'] failed with exit code 1:
  CasperMD5CheckResult: skip
  Date: Tue Sep  8 21:44:13 2020
  IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig'
  Lsusb: Error: command ['lsusb'] failed with exit code 1:
  Lsusb-t:
   
  Lsusb-v: Error: command ['lsusb', '-v'] failed with exit code 1:
  MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
  PciMultimedia:
   
  ProcEnviron:
   TERM=vt220
   PATH=(custom, no user)
   LANG=C.UTF-8
   SHELL=/bin/bash
  ProcFB: 0 bochs-drmdrmfb
  ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.8.0-18-generic 
root=UUID=ce45bbaf-5a44-4487-b89e-035c2dd40657 ro console=ttyS0 
systemd.mask=snapd.seeded.service systemd.mask=snapd.service panic=-1 
softlockup_panic=1 hung_task_panic=1 nmi_watchdog=panic,1 ip=:::::BOOTIF:dhcp
  RelatedPackageVersions:
   linux-restricted-modules-5.8.0-18-generic N/A
   linux-backports-modules-5.8.0-18-generic  N/A
   linux-firmware                            1.190
  RfKill: Error: [Errno 2] No such file or directory: 'rfkill'
  SourcePackage: linux
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 04/01/2014
  dmi.bios.release: 0.0
  dmi.bios.vendor: SeaBIOS
  dmi.bios.version: 1.13.0-1ubuntu1
  dmi.chassis.type: 1
  dmi.chassis.vendor: QEMU
  dmi.chassis.version: pc-i440fx-focal
  dmi.modalias: 
dmi:bvnSeaBIOS:bvr1.13.0-1ubuntu1:bd04/01/2014:br0.0:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-focal:cvnQEMU:ct1:cvrpc-i440fx-focal:
  dmi.product.name: Standard PC (i440FX + PIIX, 1996)
  dmi.product.version: pc-i440fx-focal
  dmi.sys.vendor: QEMU

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894910/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to