Bugzilla – Bug 1222816
BTRFS_IOC_SNAP_CREATE_V2 returns error but did some of the work
Last modified: 2024-04-22 06:51:44 UTC
While working on bug #1222674 I noticed that the BTRFS_IOC_SNAP_CREATE_V2 ioctl when passed a non existing qgroup does create the snapshot but also reports an error (ENOENT). Is that desired behavior? Can I really on that it (ioctl does everything except adding to the qgroup)?
David, you were involved in https://github.com/gregkh/linux/commit/f19dad4f440af4ef09ca3c76bda83290391f4d2d. Please comment.
Mind to explain what did you mean by "does create the snapshot"? In my test environment with upstream kernel, it doesn't create the snapshot at all: ``` $ sudo mkfs.btrfs -f /dev/test/scratch1 $ sudo mount /dev/test/scratch1 /mnt/btrfs/ $ sudo btrfs subv create /mnt/btrfs/subv1 Create subvolume '/mnt/btrfs/subv1' $ sudo mount /dev/test/scratch1 /mnt/btrfs/ $ sudo btrfs subv create /mnt/btrfs/subv1 Create subvolume '/mnt/btrfs/subv1' ``` And in above case, the behavior is correct, the snapshot creation is rejected due to invalid qgroup inherit parameters.
(In reply to Wenruo Qu from comment #2) > Mind to explain what did you mean by "does create the snapshot"? > > In my test environment with upstream kernel, it doesn't create the snapshot > at all: > > ``` > $ sudo mkfs.btrfs -f /dev/test/scratch1 > $ sudo mount /dev/test/scratch1 /mnt/btrfs/ > $ sudo btrfs subv create /mnt/btrfs/subv1 > Create subvolume '/mnt/btrfs/subv1' > $ sudo mount /dev/test/scratch1 /mnt/btrfs/ > $ sudo btrfs subv create /mnt/btrfs/subv1 > Create subvolume '/mnt/btrfs/subv1' > ``` My bad, the command line options are copied incorrectly. The correct one is: ``` $ sudo mkfs.btrfs -f /dev/test/scratch1 $ sudo mount /dev/test/scratch1 /mnt/btrfs/ $ sudo btrfs subv create /mnt/btrfs/subv1 Create subvolume '/mnt/btrfs/subv1' $ sudo btrfs subv snapshot -i 1/0 /mnt/btrfs/subv1 /mnt/btrfs/snap1 ERROR: cannot snapshot '/mnt/btrfs/subv1': No such file or directory $ ls /mnt/btrfs/ subv1 ``` > > And in above case, the behavior is correct, the snapshot creation is > rejected due to invalid qgroup inherit parameters.
Sorry, I cannot reproduce the problem myself. Maybe I was confused.