• Naohiro Aota's avatar
    btrfs: zoned: mark relocation as writing · ca5e4ea0
    Naohiro Aota authored
    There is a hung_task issue with running generic/068 on an SMR
    device. The hang occurs while a process is trying to thaw the
    filesystem. The process is trying to take sb->s_umount to thaw the
    FS. The lock is held by fsstress, which calls btrfs_sync_fs() and is
    waiting for an ordered extent to finish. However, as the FS is frozen,
    the ordered extents never finish.
    
    Having an ordered extent while the FS is frozen is the root cause of
    the hang. The ordered extent is initiated from btrfs_relocate_chunk()
    which is called from btrfs_reclaim_bgs_work().
    
    This commit adds sb_*_write() around btrfs_relocate_chunk() call
    site. For the usual "btrfs balance" command, we already call it with
    mnt_want_file() in btrfs_ioctl_balance().
    
    Fixes: 18bb8bbf ("btrfs: zoned: automatically reclaim zones")
    CC: stable@vger.kernel.org # 5.13+
    Link: https://github.com/naota/linux/issues/56Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ca5e4ea0
volumes.c 225 KB