Skip to content

Commit 912e1a8

Browse files
committed
Merge PR ceph#62231 into main
* refs/pull/62231/head: mds: set alternate_name for new fullbit dentries qa: test alternate_name recovery during mds failover Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Kotresh Hiremath Ravishankar <[email protected]>
2 parents f0cca91 + 5fc94be commit 912e1a8

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

qa/tasks/cephfs/test_dir_charmap.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,51 @@ def test_cs_not_empty_set_insensitive(self):
269269
else:
270270
self.fail("should fail")
271271

272+
273+
class TestCharMapRecovery(CephFSTestCase, CharMapMixin):
274+
CLIENTS_REQUIRED = 1
275+
MDSS_REQUIRED = 1
276+
277+
def test_primary_altname_recovery(self):
278+
"""
279+
That the MDS can recovery the alternate_name from the primary link
280+
encoded in the fullbit.
281+
"""
282+
283+
dname = "Grüßen"
284+
self.mount_a.run_shell_payload("mkdir foo/")
285+
self.mount_a.setfattr("foo/", "ceph.dir.casesensitive", "0")
286+
self.mount_a.run_shell_payload(f"dd if=/dev/urandom of=foo/{dname} conv=fsync bs=1 count=1")
287+
self.mount_a.umount_wait()
288+
289+
self.fs.fail()
290+
self.fs.set_joinable()
291+
self.fs.wait_for_daemons()
292+
293+
self.mount_a.mount()
294+
self.mount_a.run_shell_payload("ls -l foo")
295+
296+
def test_remote_altname_recovery(self):
297+
"""
298+
That the MDS can recovery the alternate_name from the remote link
299+
encoded in the fullbit.
300+
"""
301+
302+
dname = "Grüßen"
303+
self.mount_a.run_shell_payload("mkdir foo/")
304+
self.mount_a.setfattr("foo/", "ceph.dir.casesensitive", "0")
305+
self.mount_a.run_shell_payload("dd if=/dev/urandom of=foo/file conv=fsync bs=1 count=1")
306+
self.mount_a.run_shell_payload(f"ln -T foo/file foo/{dname}")
307+
self.mount_a.umount_wait()
308+
309+
self.fs.fail()
310+
self.fs.set_joinable()
311+
self.fs.wait_for_daemons()
312+
313+
self.mount_a.mount()
314+
self.mount_a.run_shell_payload("ls -l foo")
315+
316+
272317
class TestNormalization(CephFSTestCase, CharMapMixin):
273318
"""
274319
Test charmap normalization.

src/mds/journal.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,13 +1380,15 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, int type, MDPeerUpdate
13801380
dn->set_version(fb.dnv);
13811381
if (fb.is_dirty()) dn->_mark_dirty(logseg);
13821382
dout(10) << "EMetaBlob.replay added (full) " << *dn << dendl;
1383+
dn->set_alternate_name(mempool::mds_co::string(fb.alternate_name));
13831384
} else {
13841385
dn->set_version(fb.dnv);
13851386
if (fb.is_dirty()) dn->_mark_dirty(logseg);
13861387
dout(10) << "EMetaBlob.replay for [" << fb.dnfirst << "," << fb.dnlast << "] had " << *dn << dendl;
13871388
dn->first = fb.dnfirst;
13881389
ceph_assert(dn->last == fb.dnlast);
13891390
}
1391+
ceph_assert(dn->get_alternate_name() == fb.alternate_name);
13901392
if (lump.is_importing())
13911393
dn->mark_auth();
13921394

@@ -1504,7 +1506,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, int type, MDPeerUpdate
15041506
dn->first = rb.dnfirst;
15051507
ceph_assert(dn->last == rb.dnlast);
15061508
}
1507-
1509+
ceph_assert(dn->get_alternate_name() == rb.alternate_name);
15081510
if (lump.is_importing())
15091511
dn->mark_auth();
15101512

0 commit comments

Comments
 (0)