Skip to content

lazy unmount issues #876

Open
Open
@axet

Description

@axet

Hello!

Lazy unmount happens automatically when device removed by (udev or systemd) when USB sticks with btrfs on got disconnected.

As result if any process holding any files (cwd, root, fd) from target lazy unmounted fs it will cause to lock down and as result will required to reboot the system.

For ext4 you can remount it second time no problem while previous lazy unmount keep busy waiting. But btrfs does not allow that.

Simple solution would be looking for opened files using 'lsof' but because of lazy unmount all path are cut that makes it impossible to find which process is holding btrfs file system and underlaying (md-luks device).

That is very old and known issues by users. You can google it.

It would be possible to find lazy unmouted process using lsof, but you have to know device major and minor number. For all btrfs mounts it is virtual devices with major == 0. When file system is mounted you can run 'stat /media/root/LABEL' to see device minor number which can be used to identify process working with that fs. But if device got disconnected that would be not possible to know device minor number.

Right now here is no way fixing that only option is to reboot.

It would be possible to fix if /sys/fs/btrfs/*/device_minor property will show device minor number used to mount filesystem.

In that case 'lsof | grep 0,MINOR' will show all processes holding btrfs filesystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugkernelsomething in kernel has to be done too

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions