Skip to content

Commit

Permalink
Btrfs: disable xattr operations on subvolume directories
Browse files Browse the repository at this point in the history
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: 6c6ef9f ("xattr: Stop calling {get,set,remove}xattr inode operations")
Cc: Andreas Gruenbacher <[email protected]>
Reported-by: Chris Murphy <[email protected]>
Tested-by: Chris Murphy <[email protected]>
Cc: <[email protected]> # 4.9.x
Signed-off-by: Omar Sandoval <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
osandov authored and masoncl committed Jan 26, 2017
1 parent 67ade05 commit 1fdf419
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5718,6 +5718,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(inode);
Expand Down

0 comments on commit 1fdf419

Please sign in to comment.