[GFS2] Use mutices rather than semaphores
As well as a number of minor bug fixes, this patch changes GFS
to use mutices rather than semaphores. This results in better
information in case there are any locking problems.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 9b5c319..be80771 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -279,7 +279,7 @@
name.name = buf;
- down(&sdp->sd_jindex_mutex);
+ mutex_lock(&sdp->sd_jindex_mutex);
for (;;) {
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED,
@@ -317,7 +317,7 @@
spin_unlock(&sdp->sd_jindex_spin);
}
- up(&sdp->sd_jindex_mutex);
+ mutex_unlock(&sdp->sd_jindex_mutex);
return error;
}
@@ -608,9 +608,9 @@
if (error)
return;
- down(&sdp->sd_statfs_mutex);
+ mutex_lock(&sdp->sd_statfs_mutex);
gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
- up(&sdp->sd_statfs_mutex);
+ mutex_unlock(&sdp->sd_statfs_mutex);
spin_lock(&sdp->sd_statfs_spin);
l_sc->sc_total += total;
@@ -659,9 +659,9 @@
if (error)
goto out_bh2;
- down(&sdp->sd_statfs_mutex);
+ mutex_lock(&sdp->sd_statfs_mutex);
gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
- up(&sdp->sd_statfs_mutex);
+ mutex_unlock(&sdp->sd_statfs_mutex);
spin_lock(&sdp->sd_statfs_spin);
m_sc->sc_total += l_sc->sc_total;
@@ -910,7 +910,7 @@
{
int error = 0;
- down(&sdp->sd_freeze_lock);
+ mutex_lock(&sdp->sd_freeze_lock);
if (!sdp->sd_freeze_count++) {
error = gfs2_lock_fs_check_clean(sdp, &sdp->sd_freeze_gh);
@@ -918,7 +918,7 @@
sdp->sd_freeze_count--;
}
- up(&sdp->sd_freeze_lock);
+ mutex_unlock(&sdp->sd_freeze_lock);
return error;
}
@@ -935,11 +935,11 @@
void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
{
- down(&sdp->sd_freeze_lock);
+ mutex_lock(&sdp->sd_freeze_lock);
if (sdp->sd_freeze_count && !--sdp->sd_freeze_count)
gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
- up(&sdp->sd_freeze_lock);
+ mutex_unlock(&sdp->sd_freeze_lock);
}