From fd830205bd35fcd00c67af276a4e6a8da1cda487 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Thu, 12 Feb 2015 20:24:45 +0800 Subject: [PATCH] mds: fix decoding of InodeStore::oldest_snap There is no ENCODE_START/FINISH block when encoding inode that embedded in dentry. So we can't use encoding version to check if the buffer contains InodeStore::oldest_snap. Instead, we check if the buffer iterator reaches end of buffer. Signed-off-by: Yan, Zheng --- src/mds/CInode.cc | 2 +- src/mds/CInode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 38a89d37e2f1b..779efbf461116 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -1283,7 +1283,7 @@ void InodeStore::decode_bare(bufferlist::iterator &bl, __u8 struct_v) ::decode(inode.layout, bl); // but we only care about the layout portion } } - if (struct_v >= 5) + if (struct_v >= 5 && !bl.end()) ::decode(oldest_snap, bl); } diff --git a/src/mds/CInode.h b/src/mds/CInode.h index f02ab6cb9309f..5a8809727b03a 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -95,7 +95,7 @@ public: /* Serialization without ENCODE_START/FINISH blocks for use embedded in dentry */ void encode_bare(bufferlist &bl) const; - void decode_bare(bufferlist::iterator &bl, __u8 struct_v=4); + void decode_bare(bufferlist::iterator &bl, __u8 struct_v=5); /* For use in debug and ceph-dencoder */ void dump(Formatter *f) const; -- 2.39.5