summaryrefslogtreecommitdiff
path: root/fs/gfs2/recovery.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-26 13:21:55 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-26 13:21:55 -0400
commit5965b1f4792a1a9364b4e1ed6be8778a50eb981b (patch)
tree77773aca2301eb2e11dc455e7152823bf3bde361 /fs/gfs2/recovery.c
parent3a2a9c96ac129d17aad1a5c46988ad28f72564b0 (diff)
downloadlinux-3.10-5965b1f4792a1a9364b4e1ed6be8778a50eb981b.tar.gz
linux-3.10-5965b1f4792a1a9364b4e1ed6be8778a50eb981b.tar.bz2
linux-3.10-5965b1f4792a1a9364b4e1ed6be8778a50eb981b.zip
[GFS2] Don't do recursive locking in glock layer
This patch changes the last user of recursive locking so that it no longer needs this feature and removes it from the glock layer. This makes the glock code a lot simpler and easier to understand. Its also a prerequsite to adding support for the AOP_TRUNCATED_PAGE return code (or at least it is if you don't want your brain to melt in the process) I've left in a couple of checks just in case there is some place else in the code which is still using this feature that I didn't spot yet, but they can probably be removed long term. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/recovery.c')
-rw-r--r--fs/gfs2/recovery.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index e91c2bda6c3..7d467966f92 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -436,30 +436,35 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
unsigned int pass;
int error;
- fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", jd->jd_jid);
-
- /* Aquire the journal lock so we can do recovery */
-
- error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
- LM_ST_EXCLUSIVE,
- LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
- &j_gh);
- switch (error) {
- case 0:
- break;
+ if (jd->jd_jid != sdp->sd_lockstruct.ls_jid) {
+ fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n",
+ jd->jd_jid);
- case GLR_TRYFAILED:
- fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid);
- error = 0;
+ /* Aquire the journal lock so we can do recovery */
- default:
- goto fail;
- };
+ error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
+ LM_ST_EXCLUSIVE,
+ LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
+ &j_gh);
+ switch (error) {
+ case 0:
+ break;
+
+ case GLR_TRYFAILED:
+ fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid);
+ error = 0;
+
+ default:
+ goto fail;
+ };
- error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
- LM_FLAG_NOEXP, &ji_gh);
- if (error)
- goto fail_gunlock_j;
+ error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
+ LM_FLAG_NOEXP, &ji_gh);
+ if (error)
+ goto fail_gunlock_j;
+ } else {
+ fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid);
+ }
fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid);
@@ -481,10 +486,8 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
error = gfs2_glock_nq_init(sdp->sd_trans_gl,
LM_ST_SHARED,
- LM_FLAG_NOEXP |
- LM_FLAG_PRIORITY |
- GL_NEVER_RECURSE |
- GL_NOCANCEL |
+ LM_FLAG_NOEXP | LM_FLAG_PRIORITY |
+ GL_NEVER_RECURSE | GL_NOCANCEL |
GL_NOCACHE,
&t_gh);
if (error)
@@ -521,37 +524,35 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
goto fail_gunlock_tr;
gfs2_glock_dq_uninit(&t_gh);
-
t = DIV_ROUND_UP(jiffies - t, HZ);
-
fs_info(sdp, "jid=%u: Journal replayed in %lus\n",
jd->jd_jid, t);
}
- gfs2_glock_dq_uninit(&ji_gh);
+ if (jd->jd_jid != sdp->sd_lockstruct.ls_jid)
+ gfs2_glock_dq_uninit(&ji_gh);
gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS);
- gfs2_glock_dq_uninit(&j_gh);
+ if (jd->jd_jid != sdp->sd_lockstruct.ls_jid)
+ gfs2_glock_dq_uninit(&j_gh);
fs_info(sdp, "jid=%u: Done\n", jd->jd_jid);
-
return 0;
- fail_gunlock_tr:
+fail_gunlock_tr:
gfs2_glock_dq_uninit(&t_gh);
-
- fail_gunlock_ji:
- gfs2_glock_dq_uninit(&ji_gh);
-
- fail_gunlock_j:
- gfs2_glock_dq_uninit(&j_gh);
+fail_gunlock_ji:
+ if (jd->jd_jid != sdp->sd_lockstruct.ls_jid) {
+ gfs2_glock_dq_uninit(&ji_gh);
+fail_gunlock_j:
+ gfs2_glock_dq_uninit(&j_gh);
+ }
fs_info(sdp, "jid=%u: %s\n", jd->jd_jid, (error) ? "Failed" : "Done");
- fail:
+fail:
gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP);
-
return error;
}