Skip to contentSkip to conversation

Don't use journal lock type

Cluster-devel Steven Whitehouse 2 participants 5 messages Aug 7, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

Hi,

In GFS2 journals are just normal inodes, so we should use the normal inode lock type rather than the journal lock type,

Steve.

-------------------------------------------------------------------------

fs/gfs2/glops.c +0 -4
index 777ca46..976a395 100644
@@ -488,7 +488,3 @@ const struct gfs2_glock_operations gfs2_quota_glops = {
 	.go_type = LM_TYPE_QUOTA,
 };
 
-const struct gfs2_glock_operations gfs2_journal_glops = {
-	.go_type = LM_TYPE_JOURNAL,
-};
-
fs/gfs2/glops.h +0 -1
index a1d9b5b..cddac16 100644
@@ -20,6 +20,5 @@ extern const struct gfs2_glock_operations gfs2_iopen_glops;
 extern const struct gfs2_glock_operations gfs2_flock_glops;
 extern const struct gfs2_glock_operations gfs2_nondisk_glops;
 extern const struct gfs2_glock_operations gfs2_quota_glops;
-extern const struct gfs2_glock_operations gfs2_journal_glops;
 
 #endif /* __GLOPS_DOT_H__ */
fs/gfs2/ops_fstype.c +1 -1
index 58c730b..ba1bb05 100644
@@ -348,7 +348,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
 		sdp->sd_jdesc = gfs2_jdesc_find(sdp, sdp->sd_lockstruct.ls_jid);
 
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
-					  &gfs2_journal_glops,
+					  &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
 					  &sdp->sd_journal_gh);
 		if (error) {
fs/gfs2/recovery.c +1 -1
index 5ada38c..aaac6a1 100644
@@ -452,7 +452,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
 
 		/* Aquire the journal lock so we can do recovery */
 
-		error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
+		error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE,
 					  LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
 					  &j_gh);
#1 lore raw

fs/gfs2/ops_fstype.c static int init_journal(struct gfs2_sbd *sdp, int undo) · line 353

Quoted 5 lines · Steven Whitehouse
fs/gfs2/ops_fstype.c +1 -1
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
-					  &gfs2_journal_glops,
+					  &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
 					  &sdp->sd_journal_gh);

The lock for journal N is now the same as the lock for the inode at block N -- that doesn't work.

#2 lore raw

Hi,

Quoted 10 lines · David Teigland

fs/gfs2/ops_fstype.c static int init_journal(struct gfs2_sbd *sdp, int undo) · line 353

Quoted 5 lines · Steven Whitehouse
fs/gfs2/ops_fstype.c +1 -1
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
-					  &gfs2_journal_glops,
+					  &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
 					  &sdp->sd_journal_gh);

The lock for journal N is now the same as the lock for the inode at block N -- that doesn't work.

Yes, thats the point of the patch, after all journals are now inodes. If we don't do that then two things happen:

- Accesses of the journal inodes via the meta fs will not be "in sync"
with what the kernel sees
- More importantly, and the reason why this patch was created is that
upon recovery of a journal, the cache wasn't being flushed resulting in the blocks being sometimes "seen" again the next time a node recovers the same remote journal.

Steve.

#3 lore raw
Quoted 17 lines · Steven Whitehouse

Hi,

Quoted 10 lines · David Teigland

fs/gfs2/ops_fstype.c static int init_journal(struct gfs2_sbd *sdp, int undo) · line 353

Quoted 5 lines · Steven Whitehouse
fs/gfs2/ops_fstype.c +1 -1
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
-					  &gfs2_journal_glops,
+					  &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
 					  &sdp->sd_journal_gh);

The lock for journal N is now the same as the lock for the inode at block N -- that doesn't work.

Yes, thats the point of the patch, after all journals are now inodes. If we don't do that then two things happen:

Quoted 6 lines

- Accesses of the journal inodes via the meta fs will not be "in sync"
with what the kernel sees
- More importantly, and the reason why this patch was created is that
upon recovery of a journal, the cache wasn't being flushed resulting in the blocks being sometimes "seen" again the next time a node recovers the same remote journal.

The journal with id N does not live in the inode at fs block N. So, you're still using two different locks for the journal, and one of them now collides with something else.

#4 lore raw

Hi,

Quoted 25 lines · David Teigland
Quoted 17 lines · Steven Whitehouse

Hi,

Quoted 10 lines · David Teigland

fs/gfs2/ops_fstype.c static int init_journal(struct gfs2_sbd *sdp, int undo) · line 353

Quoted 5 lines · Steven Whitehouse
fs/gfs2/ops_fstype.c +1 -1
 		error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
-					  &gfs2_journal_glops,
+					  &gfs2_inode_glops,
 					  LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
 					  &sdp->sd_journal_gh);

The lock for journal N is now the same as the lock for the inode at block N -- that doesn't work.

Yes, thats the point of the patch, after all journals are now inodes. If we don't do that then two things happen:

Quoted 6 lines

- Accesses of the journal inodes via the meta fs will not be "in sync"
with what the kernel sees
- More importantly, and the reason why this patch was created is that
upon recovery of a journal, the cache wasn't being flushed resulting in the blocks being sometimes "seen" again the next time a node recovers the same remote journal.

Quoted 4 lines

The journal with id N does not live in the inode at fs block N. So, you're still using two different locks for the journal, and one of them now collides with something else.

I see now! Well spotted, and I'll send a new patch shortly to use the inode's own lock (which is available in both places anyway),

Steve.