]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: use may_delete_dentry() in btrfs_ioctl_snap_destroy()
authorFilipe Manana <fdmanana@suse.com>
Tue, 13 Jan 2026 12:39:52 +0000 (12:39 +0000)
committerChristian Brauner <brauner@kernel.org>
Wed, 14 Jan 2026 16:17:47 +0000 (17:17 +0100)
commit5f84a1092dee7b2687804d71c0dd50edd6f2d32a
treeafaaede508da16b102b7657b3658d2a3a50a7f2b
parent26aab3a485d500cb89ef7340797982bd066f63a5
btrfs: use may_delete_dentry() in btrfs_ioctl_snap_destroy()

There is no longer the need to use btrfs_may_delete(), which was a copy
of the VFS private function may_delete(), since now that functionality
is exported by the VFS as a function named may_delete_dentry(). In fact
our local copy of may_delete() lacks an update that happened to that
function which is point number 7 in that function's comment:

  "7. If the victim has an unknown uid or gid we can't change the inode."

which corresponds to this code:

/* Inode writeback is not safe when the uid or gid are invalid. */
if (!vfsuid_valid(i_uid_into_vfsuid(idmap, inode)) ||
    !vfsgid_valid(i_gid_into_vfsgid(idmap, inode)))
return -EOVERFLOW;

As long as we keep a separate copy, duplicating code, we are also prone
to updates to the VFS being missed in our local copy.

So change btrfs_ioctl_snap_destroy() to use the VFS function and remove
btrfs_may_delete().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Link: https://patch.msgid.link/46b13dc5c957deb72a7f085916757a20878a8e73.1768307858.git.fdmanana@suse.com
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/btrfs/ioctl.c