]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix decoding of InodeStore::oldest_snap 3717/head
authorYan, Zheng <zyan@redhat.com>
Thu, 12 Feb 2015 12:24:45 +0000 (20:24 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 12 Feb 2015 12:43:26 +0000 (20:43 +0800)
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 <zyan@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h

index 38a89d37e2f1b2f16d09653a9cad9bd40bd60a59..779efbf4611161a8edc37f364ab1dee79129d490 100644 (file)
@@ -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);
 }
 
index f02ab6cb9309f37f68a40e387cb612e6cf0b6473..5a8809727b03a00f003ee334a1c02282493bff4a 100644 (file)
@@ -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;