diff options
-rw-r--r-- | fs/gfs2/ops_inode.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 2fe37aeac7b0..3a2769ebfe4a 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -615,13 +615,19 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
615 | goto out_gunlock_r; | 615 | goto out_gunlock_r; |
616 | } | 616 | } |
617 | 617 | ||
618 | num_gh = 1; | ||
618 | gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 619 | gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
619 | gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 620 | if (odip != ndip) { |
620 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 621 | gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh); |
621 | num_gh = 3; | 622 | num_gh++; |
623 | } | ||
624 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh); | ||
625 | num_gh++; | ||
622 | 626 | ||
623 | if (nip) | 627 | if (nip) { |
624 | gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++); | 628 | gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh); |
629 | num_gh++; | ||
630 | } | ||
625 | 631 | ||
626 | error = gfs2_glock_nq_m(num_gh, ghs); | 632 | error = gfs2_glock_nq_m(num_gh, ghs); |
627 | if (error) | 633 | if (error) |