Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2bdf9a8 authored by Josef Bacik's avatar Josef Bacik
Browse files

Btrfs: make sure NODATACOW also gets NODATASUM set



A user reported hitting the BUG_ON() in btrfs_finished_ordered_io() where we had
csums on a NOCOW extent.  This can happen if we have NODATACOW set but not
NODATASUM set, which can happen in two cases, either we mount with -o nodatacow
and then write into preallocated space, or chattr +C a directory and move a file
into that directory.  Liu has fixed the move case in a different place, but this
fixes the mount -o nodatacow case.  Thanks,

Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent dc81cdc5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5574,7 +5574,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
		if (btrfs_test_opt(root, NODATASUM))
			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
		if (btrfs_test_opt(root, NODATACOW))
			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW |
				BTRFS_INODE_NODATASUM;
	}

	insert_inode_hash(inode);