Skip to content

Commit 2297ab6

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Fix problems regarding gfs2_qa_get and _put
This patch fixes a couple of places in which gfs2_qa_get and gfs2_qa_put are not balanced: we now keep references around whenever a file is open for writing (see gfs2_open_common and gfs2_release), so we need to put all references we grab in function gfs2_create_inode. This was broken in the successful case and on one error path. This also means that we don't have a reference to put in gfs2_evict_inode. In addition, gfs2_qa_put was called for the wrong inode in gfs2_link. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent aa83da7 commit 2297ab6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fs/gfs2/inode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
622622
error = finish_no_open(file, NULL);
623623
}
624624
gfs2_glock_dq_uninit(ghs);
625-
return error;
625+
goto fail;
626626
} else if (error != -ENOENT) {
627627
goto fail_gunlock;
628628
}
@@ -764,9 +764,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
764764
error = finish_open(file, dentry, gfs2_open_common);
765765
}
766766
gfs2_glock_dq_uninit(ghs);
767+
gfs2_qa_put(ip);
767768
gfs2_glock_dq_uninit(ghs + 1);
768769
clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
769770
gfs2_glock_put(io_gl);
771+
gfs2_qa_put(dip);
770772
return error;
771773

772774
fail_gunlock3:
@@ -776,7 +778,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
776778
clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
777779
gfs2_glock_put(io_gl);
778780
fail_free_inode:
779-
gfs2_qa_put(ip);
780781
if (ip->i_gl) {
781782
glock_clear_object(ip->i_gl, ip);
782783
gfs2_glock_put(ip->i_gl);
@@ -1005,7 +1006,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
10051006
out_child:
10061007
gfs2_glock_dq(ghs);
10071008
out_parent:
1008-
gfs2_qa_put(ip);
1009+
gfs2_qa_put(dip);
10091010
gfs2_holder_uninit(ghs);
10101011
gfs2_holder_uninit(ghs + 1);
10111012
return error;

fs/gfs2/super.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,6 @@ static void gfs2_evict_inode(struct inode *inode)
14041404
if (ip->i_qadata)
14051405
gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0);
14061406
gfs2_rs_delete(ip, NULL);
1407-
gfs2_qa_put(ip);
14081407
gfs2_ordered_del_inode(ip);
14091408
clear_inode(inode);
14101409
gfs2_dir_hash_inval(ip);

0 commit comments

Comments
 (0)