fix loss of dir layout info on mds restart
Here's a fix for bug 1435. The MDS didn't recover default_layout for subdirs from dir entries encoded in the parent dir, so layout policies could be lost upon MDS restart if they didn't happen to be encoded in some other change still present in the MDS journal.
Fix restoring dir layouts from dir entries
From: Alexandre Oliva <[email protected]>
Signed-off-by Alexandre Oliva <[email protected]>
--- src/mds/CDir.cc | 10 ++++++++++ 1 file changed, 10 insertions(+)
src/mds/CDir.cc +10 -0
@@ -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);
Signature · 5 lines
-- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer