aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2017-06-30 08:55:08 -0400
committerBob Peterson <rpeterso@redhat.com>2017-07-05 08:20:52 -0400
commit6f6597baae206c544c49ad7f1129d5adc1e9019d (patch)
tree3bcfcb1ebf6713cdd95f4146012c236e3d6f5fbf /fs/gfs2/inode.c
parent4fd1a5795214bc6405f14691c1344ae8c3f17215 (diff)
gfs2: Protect gl->gl_object by spin lock
Put all remaining accesses to gl->gl_object under the gl->gl_lockref.lock spinlock to prevent races. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 912d4e66fabc..50108fa724c7 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -202,14 +202,14 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
202 202
203fail_refresh: 203fail_refresh:
204 ip->i_iopen_gh.gh_flags |= GL_NOCACHE; 204 ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
205 ip->i_iopen_gh.gh_gl->gl_object = NULL; 205 glock_set_object(ip->i_iopen_gh.gh_gl, NULL);
206 gfs2_glock_dq_uninit(&ip->i_iopen_gh); 206 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
207fail_put: 207fail_put:
208 if (io_gl) 208 if (io_gl)
209 gfs2_glock_put(io_gl); 209 gfs2_glock_put(io_gl);
210 if (gfs2_holder_initialized(&i_gh)) 210 if (gfs2_holder_initialized(&i_gh))
211 gfs2_glock_dq_uninit(&i_gh); 211 gfs2_glock_dq_uninit(&i_gh);
212 ip->i_gl->gl_object = NULL; 212 glock_set_object(ip->i_gl, NULL);
213fail: 213fail:
214 iget_failed(inode); 214 iget_failed(inode);
215 return ERR_PTR(error); 215 return ERR_PTR(error);
@@ -706,7 +706,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
706 if (error) 706 if (error)
707 goto fail_free_inode; 707 goto fail_free_inode;
708 708
709 ip->i_gl->gl_object = ip; 709 glock_set_object(ip->i_gl, ip);
710 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, ghs + 1); 710 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, ghs + 1);
711 if (error) 711 if (error)
712 goto fail_free_inode; 712 goto fail_free_inode;
@@ -732,7 +732,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
732 if (error) 732 if (error)
733 goto fail_gunlock2; 733 goto fail_gunlock2;
734 734
735 ip->i_iopen_gh.gh_gl->gl_object = ip; 735 glock_set_object(ip->i_iopen_gh.gh_gl, ip);
736 gfs2_glock_put(io_gl); 736 gfs2_glock_put(io_gl);
737 gfs2_set_iop(inode); 737 gfs2_set_iop(inode);
738 insert_inode_hash(inode); 738 insert_inode_hash(inode);