diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-06-07 06:47:52 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-09 03:23:22 -0400 |
commit | e1cc86037b689a82cdb2df50c32fa8cf9d6b6c3a (patch) | |
tree | 8d7502be9841fae1f13afd2676b86c9139ac0fc2 /fs/gfs2 | |
parent | ffed8ab342e39b8b5f4d5c94c37a708e225ffcd8 (diff) |
[GFS2] Fix bug in error path of inode
This fixes a bug in the ordering of operations in the error path of
createi. Its not valid to do an iput() when holding the inode's glock
since the iput() will (in this case) result in delete_inode() being
called which needs to grab the lock itself. This was causing the
recursive lock checking code to trigger.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 3ef0f051d076..87505f7eb745 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -857,7 +857,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip) | |||
857 | struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | 857 | struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, |
858 | unsigned int mode, dev_t dev) | 858 | unsigned int mode, dev_t dev) |
859 | { | 859 | { |
860 | struct inode *inode; | 860 | struct inode *inode = NULL; |
861 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; | 861 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; |
862 | struct inode *dir = &dip->i_inode; | 862 | struct inode *dir = &dip->i_inode; |
863 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 863 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
@@ -900,28 +900,28 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
900 | 900 | ||
901 | error = gfs2_inode_refresh(GFS2_I(inode)); | 901 | error = gfs2_inode_refresh(GFS2_I(inode)); |
902 | if (error) | 902 | if (error) |
903 | goto fail_iput; | 903 | goto fail_gunlock2; |
904 | 904 | ||
905 | error = gfs2_acl_create(dip, GFS2_I(inode)); | 905 | error = gfs2_acl_create(dip, GFS2_I(inode)); |
906 | if (error) | 906 | if (error) |
907 | goto fail_iput; | 907 | goto fail_gunlock2; |
908 | 908 | ||
909 | error = gfs2_security_init(dip, GFS2_I(inode)); | 909 | error = gfs2_security_init(dip, GFS2_I(inode)); |
910 | if (error) | 910 | if (error) |
911 | goto fail_iput; | 911 | goto fail_gunlock2; |
912 | 912 | ||
913 | error = link_dinode(dip, name, GFS2_I(inode)); | 913 | error = link_dinode(dip, name, GFS2_I(inode)); |
914 | if (error) | 914 | if (error) |
915 | goto fail_iput; | 915 | goto fail_gunlock2; |
916 | 916 | ||
917 | if (!inode) | 917 | if (!inode) |
918 | return ERR_PTR(-ENOMEM); | 918 | return ERR_PTR(-ENOMEM); |
919 | return inode; | 919 | return inode; |
920 | 920 | ||
921 | fail_iput: | ||
922 | iput(inode); | ||
923 | fail_gunlock2: | 921 | fail_gunlock2: |
924 | gfs2_glock_dq_uninit(ghs + 1); | 922 | gfs2_glock_dq_uninit(ghs + 1); |
923 | if (inode) | ||
924 | iput(inode); | ||
925 | fail_gunlock: | 925 | fail_gunlock: |
926 | gfs2_glock_dq(ghs); | 926 | gfs2_glock_dq(ghs); |
927 | fail: | 927 | fail: |