diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-12-09 08:55:12 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-01-08 08:42:42 -0500 |
commit | 24b977b5fdea09bf356428870d32c09a275c8a3e (patch) | |
tree | 60b93ab4d8ac034952d658a35057d5e729bd331a /fs/gfs2/ops_inode.c | |
parent | 56aa616a03feca630d5afce647367a5d8cfc67b8 (diff) |
GFS2: Fix locking bug in rename
The rename code was taking a resource group lock in cases where
it wasn't actually needed, this caused problems if the rename
was resulting in an inode being unlinked. The patch ensures that
we only take the rgrp lock early if it is really needed.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r-- | fs/gfs2/ops_inode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 247436c10deb..78f73ca1ef3e 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -748,7 +748,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
748 | struct gfs2_rgrpd *nrgd; | 748 | struct gfs2_rgrpd *nrgd; |
749 | unsigned int num_gh; | 749 | unsigned int num_gh; |
750 | int dir_rename = 0; | 750 | int dir_rename = 0; |
751 | int alloc_required; | 751 | int alloc_required = 0; |
752 | unsigned int x; | 752 | unsigned int x; |
753 | int error; | 753 | int error; |
754 | 754 | ||
@@ -867,7 +867,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
867 | goto out_gunlock; | 867 | goto out_gunlock; |
868 | } | 868 | } |
869 | 869 | ||
870 | alloc_required = error = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | 870 | if (nip == NULL) |
871 | alloc_required = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | ||
872 | error = alloc_required; | ||
871 | if (error < 0) | 873 | if (error < 0) |
872 | goto out_gunlock; | 874 | goto out_gunlock; |
873 | error = 0; | 875 | error = 0; |