Fix restoring dir layouts from dir entries
From: Alexandre Oliva <oliva@gnu.org>
Signed-off-by: Alexandre Oliva <oliva@gnu.org>
---
src/mds/CDir.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
@@ -1566,6 +1566,16 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn)
// symlink?
if (in->is_symlink())
in->symlink = symlink;
+ else if (in->is_dir()) {
+ default_file_layout dfl;
+ memset(&dfl, 0, sizeof(dfl));
+ // FIXME: this should be properly encoded
+ if (memcmp (&dfl.layout, &in->inode.layout, sizeof(dfl)) != 0) {
+ in->default_layout = new default_file_layout;
+ memcpy (&in->default_layout->layout,
+ &in->inode.layout, sizeof(dfl));
+ }
+ }
in->dirfragtree.swap(fragtree);
in->xattrs.swap(xattrs);