Skip to content

Commit

Permalink
GFS2: Fix locking bug in rename
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Whitehouse committed Jan 8, 2010
1 parent 56aa616 commit 24b977b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/gfs2/ops_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
struct gfs2_rgrpd *nrgd;
unsigned int num_gh;
int dir_rename = 0;
int alloc_required;
int alloc_required = 0;
unsigned int x;
int error;

Expand Down Expand Up @@ -867,7 +867,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
goto out_gunlock;
}

alloc_required = error = gfs2_diradd_alloc_required(ndir, &ndentry->d_name);
if (nip == NULL)
alloc_required = gfs2_diradd_alloc_required(ndir, &ndentry->d_name);
error = alloc_required;
if (error < 0)
goto out_gunlock;
error = 0;
Expand Down

0 comments on commit 24b977b

Please sign in to comment.