gfs2: Don't reread inodes unnecessarily
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 15 Apr 2025 06:49:55 +0000 (08:49 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 21 Apr 2025 16:20:36 +0000 (18:20 +0200)
In gfs2_create_inode(), we initialize the inode from scratch and then we
write the result to disk.  Clear the GLF_INSTANTIATE_NEEDED glock flag
to indicate that the inode is up to date.  Otherwise, the next time the
inode glock is acquired, gfs2_instantiate() would reread the inode from
disk, which isn't necessary.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/inode.c

index 9621680814b8050625b255c9c1447f80f27a081c..62ff09264f0fdf1c473db0af601982302b9b0013 100644 (file)
@@ -768,6 +768,7 @@ retry:
        error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, &gh);
        if (error)
                goto fail_gunlock3;
+       clear_bit(GLF_INSTANTIATE_NEEDED, &ip->i_gl->gl_flags);
 
        error = gfs2_trans_begin(sdp, blocks, 0);
        if (error)