]> git.hungrycats.org Git - linux/commitdiff
Btrfs: disable xattr operations on subvolume directories
authorOmar Sandoval <osandov@fb.com>
Thu, 26 Jan 2017 01:06:39 +0000 (17:06 -0800)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Fri, 28 Jul 2017 18:22:13 +0000 (14:22 -0400)
commit 1fdf41941b8010691679638f8d0c8d08cfee7726 upstream.

When you snapshot a subvolume containing a subvolume, you get a
placeholder directory where the subvolume would be. These directory
inodes have ->i_ops set to btrfs_dir_ro_inode_operations. Previously,
these i_ops didn't include the xattr operation callbacks. The conversion
to xattr_handlers missed this case, leading to bogus attempts to set
xattrs on these inodes. This manifested itself as failures when running
delayed inodes.

To fix this, clear IOP_XATTR in ->i_opflags on these inodes.

Fixes: 6c6ef9f26e59 ("xattr: Stop calling {get,set,remove}xattr inode operations")
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Reported-by: Chris Murphy <lists@colorremedies.com>
Tested-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ad80fada9d6d8177d1593a9b5772e80a758db595)

fs/btrfs/inode.c

index 0e4adc7e602efc1863b8350a5ecb16ba5df251eb..cafff04835eb01b1a89cf5d85de0a9b90c8052a5 100644 (file)
@@ -5660,6 +5660,7 @@ static struct inode *new_simple_dir(struct super_block *s,
 
        inode->i_ino = BTRFS_EMPTY_SUBVOL_DIR_OBJECTID;
        inode->i_op = &btrfs_dir_ro_inode_operations;
+       inode->i_opflags &= ~IOP_XATTR;
        inode->i_fop = &simple_dir_operations;
        inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
        inode->i_mtime = CURRENT_TIME;