aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlmglue.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-06-19 18:14:13 -0400
committerJoel Becker <joel.becker@oracle.com>2009-06-22 17:24:30 -0400
commit1c520dfbf391e1617ef61553f815b8006a066c44 (patch)
treebb7e7e7b1225d6e42a61c56e52cbb627c5d2f3b4 /fs/ocfs2/dlmglue.c
parent3fe0344faf7fdcb158bd5c1a9aec960a8d70c8e8 (diff)
ocfs2: Provide the ocfs2_dlm_lvb_valid() stack API.
The Lock Value Block (LVB) of a DLM lock can be lost when nodes die and the DLM cannot reconstruct its state. Clients of the DLM need to know this. ocfs2's internal DLM, o2dlm, explicitly zeroes out the LVB when it loses track of the state. This is not a standard behavior, but ocfs2 has always relied on it. Thus, an o2dlm LVB is always "valid". ocfs2 now supports both o2dlm and fs/dlm via the stack glue. When fs/dlm loses track of an LVBs state, it sets a flag (DLM_SBF_VALNOTVALID) on the Lock Status Block (LKSB). The contents of the LVB may be garbage or merely stale. ocfs2 doesn't want to try to guess at the validity of the stale LVB. Instead, it should be checking the VALNOTVALID flag. As this is the 'standard' way of treating LVBs, we will promote this behavior. We add a stack glue API ocfs2_dlm_lvb_valid(). It returns non-zero when the LVB is valid. o2dlm will always return valid, while fs/dlm will check VALNOTVALID. Signed-off-by: Joel Becker <joel.becker@oracle.com> Acked-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r--fs/ocfs2/dlmglue.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 6cdeaa76f27f..83d2ddb27186 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1989,7 +1989,8 @@ static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
1989{ 1989{
1990 struct ocfs2_meta_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb); 1990 struct ocfs2_meta_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
1991 1991
1992 if (lvb->lvb_version == OCFS2_LVB_VERSION 1992 if (ocfs2_dlm_lvb_valid(&lockres->l_lksb)
1993 && lvb->lvb_version == OCFS2_LVB_VERSION
1993 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation) 1994 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
1994 return 1; 1995 return 1;
1995 return 0; 1996 return 0;
@@ -2382,7 +2383,8 @@ int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno, int ex)
2382 return status; 2383 return status;
2383 2384
2384 lvb = ocfs2_dlm_lvb(&lockres->l_lksb); 2385 lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
2385 if (lvb->lvb_version == OCFS2_ORPHAN_LVB_VERSION) 2386 if (ocfs2_dlm_lvb_valid(&lockres->l_lksb) &&
2387 lvb->lvb_version == OCFS2_ORPHAN_LVB_VERSION)
2386 *seqno = be32_to_cpu(lvb->lvb_os_seqno); 2388 *seqno = be32_to_cpu(lvb->lvb_os_seqno);
2387 return status; 2389 return status;
2388} 2390}
@@ -3627,7 +3629,8 @@ static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo)
3627 struct ocfs2_global_disk_dqinfo *gdinfo; 3629 struct ocfs2_global_disk_dqinfo *gdinfo;
3628 int status = 0; 3630 int status = 0;
3629 3631
3630 if (lvb->lvb_version == OCFS2_QINFO_LVB_VERSION) { 3632 if (ocfs2_dlm_lvb_valid(&lockres->l_lksb) &&
3633 lvb->lvb_version == OCFS2_QINFO_LVB_VERSION) {
3631 info->dqi_bgrace = be32_to_cpu(lvb->lvb_bgrace); 3634 info->dqi_bgrace = be32_to_cpu(lvb->lvb_bgrace);
3632 info->dqi_igrace = be32_to_cpu(lvb->lvb_igrace); 3635 info->dqi_igrace = be32_to_cpu(lvb->lvb_igrace);
3633 oinfo->dqi_syncms = be32_to_cpu(lvb->lvb_syncms); 3636 oinfo->dqi_syncms = be32_to_cpu(lvb->lvb_syncms);