Skip to content

Commit 8793e14

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: set glock object after nq
Before this patch, function gfs2_create_inode called glock_set_object to set the gl_object for inode and iopen glocks before the glock was locked. That's wrong because other competing processes like evict may be blocked waiting for the glock and still have gl_object set before the actual eviction can take place. This patch moves the call to glock_set_object until after the glock is acquire in function gfs2_create_inode, so it waits for possibly competing evicts to finish their processing first. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 4b3113a commit 8793e14

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/gfs2/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,18 +731,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
731731
if (error)
732732
goto fail_free_inode;
733733
flush_delayed_work(&ip->i_gl->gl_work);
734-
glock_set_object(ip->i_gl, ip);
735734

736735
error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
737736
if (error)
738737
goto fail_free_inode;
739738
gfs2_cancel_delete_work(io_gl);
740-
glock_set_object(io_gl, ip);
741739

742740
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, ghs + 1);
743741
if (error)
744742
goto fail_gunlock2;
745743

744+
glock_set_object(ip->i_gl, ip);
746745
error = gfs2_trans_begin(sdp, blocks, 0);
747746
if (error)
748747
goto fail_gunlock2;
@@ -758,6 +757,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
758757
if (error)
759758
goto fail_gunlock2;
760759

760+
glock_set_object(io_gl, ip);
761761
gfs2_set_iop(inode);
762762
insert_inode_hash(inode);
763763

0 commit comments

Comments
 (0)