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>
This commit is contained in:
Родитель
4b3113a257
Коммит
8793e14985
|
@ -731,18 +731,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_free_inode;
|
goto fail_free_inode;
|
||||||
flush_delayed_work(&ip->i_gl->gl_work);
|
flush_delayed_work(&ip->i_gl->gl_work);
|
||||||
glock_set_object(ip->i_gl, ip);
|
|
||||||
|
|
||||||
error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
|
error = gfs2_glock_get(sdp, ip->i_no_addr, &gfs2_iopen_glops, CREATE, &io_gl);
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_free_inode;
|
goto fail_free_inode;
|
||||||
gfs2_cancel_delete_work(io_gl);
|
gfs2_cancel_delete_work(io_gl);
|
||||||
glock_set_object(io_gl, ip);
|
|
||||||
|
|
||||||
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, ghs + 1);
|
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, ghs + 1);
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_gunlock2;
|
goto fail_gunlock2;
|
||||||
|
|
||||||
|
glock_set_object(ip->i_gl, ip);
|
||||||
error = gfs2_trans_begin(sdp, blocks, 0);
|
error = gfs2_trans_begin(sdp, blocks, 0);
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_gunlock2;
|
goto fail_gunlock2;
|
||||||
|
@ -758,6 +757,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_gunlock2;
|
goto fail_gunlock2;
|
||||||
|
|
||||||
|
glock_set_object(io_gl, ip);
|
||||||
gfs2_set_iop(inode);
|
gfs2_set_iop(inode);
|
||||||
insert_inode_hash(inode);
|
insert_inode_hash(inode);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче