Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subvolume::get() works if given a path not at the root of a subvolume, contrary to comment #16

Open
agrover opened this issue Sep 18, 2020 · 1 comment

Comments

@agrover
Copy link
Collaborator

agrover commented Sep 18, 2020

    /// Get a subvolume.
    ///
    /// The path must point to the root of a subvolume.

I tried calling Subvolume::get() with the path to a normal directory on a btrfs filesystem and it worked, contrary to what the above comment says. I'm not sure if the code, or the comment, needs to be changed.

@cezarmathe
Copy link
Owner

then it seems like btrfs_util_is_subvolume is returning true even if the path is not the root of a subvolume. I think one way to solve this issue is to cannonicalize the path and then check if stripping the last path component yields the same subvolume id, a different id, or returns either the NOT_SUBVOLUME or the NOT_BTRFS subvolume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants