bcachefs: fix fsync after create
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 23 Jul 2018 09:48:35 +0000 (05:48 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:08 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs.c

index cd29404..5963f88 100644 (file)
@@ -327,6 +327,7 @@ __bch2_create(struct mnt_idmap *idmap,
        struct bch_inode_unpacked inode_u;
        struct bch_hash_info hash_info;
        struct posix_acl *default_acl = NULL, *acl = NULL;
+       u64 journal_seq = 0;
        int ret;
 
        bch2_inode_init(c, &inode_u, 0, 0, 0, rdev, &dir->ei_inode);
@@ -391,7 +392,7 @@ retry:
                                          &inode_u)
                 : 0) ?:
                bch2_trans_commit(&trans, NULL, NULL,
-                                 &inode->ei_journal_seq,
+                                 &journal_seq,
                                  BTREE_INSERT_ATOMIC|
                                  BTREE_INSERT_NOUNLOCK);
        if (ret == -EINTR)
@@ -409,6 +410,7 @@ retry:
        }
 
        bch2_vfs_inode_init(c, inode, &inode_u);
+       journal_seq_copy(inode, journal_seq);
 
        set_cached_acl(&inode->v, ACL_TYPE_ACCESS, acl);
        set_cached_acl(&inode->v, ACL_TYPE_DEFAULT, default_acl);