Skip to content

Commit f9e2d82

Browse files
author
Mark Fasheh
committed
ocfs2: Encode i_generation in the meta data lvb
When i_generation is removed from the lockname, this will help us determine whether a meta data lvb has information that is in sync with the local struct inode. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
1 parent 4d3b83f commit f9e2d82

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

fs/ocfs2/dlmglue.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,7 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
14271427
lvb->lvb_imtime_packed =
14281428
cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime));
14291429
lvb->lvb_iattr = cpu_to_be32(oi->ip_attr);
1430+
lvb->lvb_igeneration = cpu_to_be32(inode->i_generation);
14301431

14311432
mlog_meta_lvb(0, lockres);
14321433

@@ -1482,11 +1483,13 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
14821483
mlog_exit_void();
14831484
}
14841485

1485-
static inline int ocfs2_meta_lvb_is_trustable(struct ocfs2_lock_res *lockres)
1486+
static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
1487+
struct ocfs2_lock_res *lockres)
14861488
{
14871489
struct ocfs2_meta_lvb *lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
14881490

1489-
if (lvb->lvb_version == OCFS2_LVB_VERSION)
1491+
if (lvb->lvb_version == OCFS2_LVB_VERSION
1492+
&& be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
14901493
return 1;
14911494
return 0;
14921495
}
@@ -1583,7 +1586,7 @@ static int ocfs2_meta_lock_update(struct inode *inode,
15831586
* map (directories, bitmap files, etc) */
15841587
ocfs2_extent_map_trunc(inode, 0);
15851588

1586-
if (ocfs2_meta_lvb_is_trustable(lockres)) {
1589+
if (ocfs2_meta_lvb_is_trustable(inode, lockres)) {
15871590
mlog(0, "Trusting LVB on inode %llu\n",
15881591
(unsigned long long)oi->ip_blkno);
15891592
ocfs2_refresh_inode_from_lvb(inode);
@@ -3166,8 +3169,9 @@ void ocfs2_dump_meta_lvb_info(u64 level,
31663169

31673170
mlog(level, "LVB information for %s (called from %s:%u):\n",
31683171
lockres->l_name, function, line);
3169-
mlog(level, "version: %u, clusters: %u\n",
3170-
lvb->lvb_version, be32_to_cpu(lvb->lvb_iclusters));
3172+
mlog(level, "version: %u, clusters: %u, generation: 0x%x\n",
3173+
lvb->lvb_version, be32_to_cpu(lvb->lvb_iclusters),
3174+
be32_to_cpu(lvb->lvb_igeneration));
31713175
mlog(level, "size: %llu, uid %u, gid %u, mode 0x%x\n",
31723176
(unsigned long long)be64_to_cpu(lvb->lvb_isize),
31733177
be32_to_cpu(lvb->lvb_iuid), be32_to_cpu(lvb->lvb_igid),

fs/ocfs2/dlmglue.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "dcache.h"
3131

32-
#define OCFS2_LVB_VERSION 3
32+
#define OCFS2_LVB_VERSION 4
3333

3434
struct ocfs2_meta_lvb {
3535
__be16 lvb_reserved0;
@@ -45,7 +45,8 @@ struct ocfs2_meta_lvb {
4545
__be16 lvb_imode;
4646
__be16 lvb_inlink;
4747
__be32 lvb_iattr;
48-
__be32 lvb_reserved[2];
48+
__be32 lvb_igeneration;
49+
__be32 lvb_reserved2;
4950
};
5051

5152
/* ocfs2_meta_lock_full() and ocfs2_data_lock_full() 'arg_flags' flags */

0 commit comments

Comments
 (0)