Bug 1971877 - mkswap some-file gets stuck
Summary: mkswap some-file gets stuck
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1971989
TreeView+ depends on / blocked
 
Reported: 2021-06-14 21:20 UTC by Brian Lane
Modified: 2022-12-13 15:25 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1971989 (view as bug list)
Environment:
Last Closed: 2022-12-13 15:25:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Brian Lane 2021-06-14 21:20:20 UTC
Description of problem:
While scratch building a new version of parted we discovered that the test suite gets stuck running mkswap on a file and never exits.

https://koji.fedoraproject.org/koji/taskinfo?taskID=70093944

The setup for the mock used by the builder is here:

https://kojipkgs.fedoraproject.org//work/tasks/4003/70094003/mock_output.log

It is using util-linux-core-2.37-2.fc35.x86_64


The test that is getting stuck is basically doing this:

dd if=/dev/null of=loop-file bs=1 seek=1M
mkswap loop-file
parted -s loop-file mklabel msdos

An strace of the stuck process on the builder shows it stuck in a loop doing this repeatedly:

26902 ioctl(3, FS_IOC_FIEMAP, {fm_start=4820512, fm_length=18446744073709551615, fm_flags=FIEMAP_FLAG_SYNC, fm_extent_count=145} => {fm_flags=FIEMAP_FLAG_SYNC, fm_mapped_extents=0, ...}) = 0

The builder is Fedora 34 with kernel 5.12.8-300.fc34 and this is running in a rawhide mock environment.

I have been unable to reproduce this locally, sorry about that. It does seem to hit all the koji builder arches except for i686.

Comment 1 Brian Lane 2021-06-14 21:51:42 UTC
If I switch it to using 'dd if=/dev/zero of=loop-file bs=1M count=1' instead of /dev/null it doesn't get stuck so it appears to be related to having a file that's just one big hole. 

A later use of mkswap on a file created with dd.../dev/null also doesn't fail because (I think) the file is written to before the mkswap is run on it (parted test t9050).

Comment 2 Robert-André Mauchin 🐧 2021-06-14 21:52:26 UTC
Result of the bisection:

95025c29e2ae7b1b203fb18d57509f675e924cd is the first bad commit
commit 195025c29e2ae7b1b203fb18d57509f675e924cd
Author: Karel Zak <kzak>
Date:   Wed Sep 9 11:00:40 2020 +0200

    mkswap: check for holes and unwanted extentd in file
    
    Let's make mkswap(8) more user-friend and report possible swapon
    issues already when user initialize a swap file. The extents check
    produces warnings, no exit with error.
    
      # dd if=/dev/zero of=img count=100 bs=1MiB
      # chmod 0600 img
    
      # fallocate --dig-hole --offset 64520192 --length 1MiB img
      # fallocate --dig-hole --offset 84520960 --length 1MiB img
    
      # ./mkswap img
      mkswap: extents check failed:
        - hole detected at offset 64520192 (size 1048576 bytes)
        - hole detected at offset 84520960 (size 1048576 bytes)
      file img can be rejected by kernel on swap activation.
    
      Setting up swapspace version 1, size = 100 MiB (104853504 bytes)
      no label, UUID=92091112-26b5-47aa-a02a-592e52528319
    
    It checks for holes in the file, and for unknown, inline, shared and
    deallocated extents.
    
    Addresses: https://github.com/karelzak/util-linux/issues/1120
    Signed-off-by: Karel Zak <kzak>

 configure.ac        |  1 +
 disk-utils/mkswap.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 95 insertions(+), 2 deletions(-)

Comment 3 Karel Zak 2021-06-15 10:09:41 UTC
Fixed by upstream commit 8a3a74160b96498d672e3652827aa7e6d7f3a120. The change will be available in v2.37.1.

Comment 4 Ben Cotton 2021-08-10 13:07:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 5 Ben Cotton 2022-11-29 16:58:50 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 6 Ben Cotton 2022-12-13 15:25:11 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.