From: Yan, Zheng Date: Thu, 12 Feb 2015 12:24:45 +0000 (+0800) Subject: mds: fix decoding of InodeStore::oldest_snap X-Git-Tag: v0.93~19^2~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fd830205bd35fcd00c67af276a4e6a8da1cda487;p=ceph.git 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 --- diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 38a89d37e2f1..779efbf46111 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 f02ab6cb9309..5a8809727b03 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;