Skip to content

Commit bd4da04

Browse files
tangyoulingKent Overstreet
authored andcommitted
bcachefs: Move the ei_flags setting to after initialization
`inode->ei_flags` setting and cleaning should be done after initialization, otherwise the operation is invalid. Fixes: 9ca4853 ("bcachefs: Fix quota support for snapshots") Signed-off-by: Youling Tang <tangyouling@kylinos.cn> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 2fe79ce commit bd4da04

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/bcachefs/fs.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,11 +1497,6 @@ static void bch2_vfs_inode_init(struct btree_trans *trans, subvol_inum inum,
14971497
bch2_iget5_set(&inode->v, &inum);
14981498
bch2_inode_update_after_write(trans, inode, bi, ~0);
14991499

1500-
if (BCH_SUBVOLUME_SNAP(subvol))
1501-
set_bit(EI_INODE_SNAPSHOT, &inode->ei_flags);
1502-
else
1503-
clear_bit(EI_INODE_SNAPSHOT, &inode->ei_flags);
1504-
15051500
inode->v.i_blocks = bi->bi_sectors;
15061501
inode->v.i_ino = bi->bi_inum;
15071502
inode->v.i_rdev = bi->bi_dev;
@@ -1513,6 +1508,9 @@ static void bch2_vfs_inode_init(struct btree_trans *trans, subvol_inum inum,
15131508
inode->ei_qid = bch_qid(bi);
15141509
inode->ei_subvol = inum.subvol;
15151510

1511+
if (BCH_SUBVOLUME_SNAP(subvol))
1512+
set_bit(EI_INODE_SNAPSHOT, &inode->ei_flags);
1513+
15161514
inode->v.i_mapping->a_ops = &bch_address_space_operations;
15171515

15181516
switch (inode->v.i_mode & S_IFMT) {

0 commit comments

Comments
 (0)