Skip to content

Commit 449b026

Browse files
committed
Merge PR ceph#61555 into main
* refs/pull/61555/head: mds: do not path traverse a damaged dirfrag qa: test file create on damaged directory Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Christopher Hoffman <[email protected]> Reviewed-by: Viacheslav Dubeyko <[email protected]>
2 parents 04d74f5 + 3243af4 commit 449b026

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.githubmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,4 @@ ffilz Frank S. Filz <[email protected]>
191191
Jayaprakash-ibm Jaya Prakash Madaka <[email protected]>
192192
spuiuk Sachin Prabhu <[email protected]>
193193
anoopcs9 Anoop C S <[email protected]>
194+
dubeyko Viacheslav Dubeyko <[email protected]>

qa/tasks/cephfs/test_damage.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,3 +662,33 @@ def test_dentry_first_precommit(self):
662662
self.mount_a.mount_wait()
663663
self.mount_a.run_shell_payload("stat a/ && find a/")
664664
self.fs.flush()
665+
666+
def test_missing_dirfrag_create(self):
667+
"""
668+
That the MDS won't let you manipulate dentries in a missing dirfrag.
669+
"""
670+
671+
self.mount_a.run_shell_payload("mkdir -p dir_x/dir_xx/dir_xxx/")
672+
self.mount_a.run_shell_payload("touch dir_x/dir_xx/dir_xxx/file_y")
673+
self.mount_a.umount()
674+
d = self.fs.read_cache("dir_x/dir_xx", depth=0)
675+
self.fs.flush()
676+
time.sleep(5)
677+
self.fs.flush() # EUpdate scatter_writebehind
678+
self.fs.fail()
679+
dirfrag_obj = "{0:x}.00000000".format(d[0]['ino'])
680+
self.fs.radosm(["rm", dirfrag_obj]),
681+
self.fs.set_joinable()
682+
self.fs.wait_for_daemons()
683+
self.mount_a.mount_wait()
684+
try:
685+
p = self.mount_a.run_shell_payload("touch dir_x/dir_xx/file_x", wait=False)
686+
# CDir.cc: 1438: FAILED ceph_assert(get_version() < pv)
687+
wait([p], 20)
688+
self.fs.flush()
689+
except MaxWhileTries:
690+
self.fail("MDS probably crashed")
691+
except CommandFailedError:
692+
self.assertTrue("Input/output error" in p.stderr.getvalue())
693+
else:
694+
self.fail("command should fail")

src/mds/MDCache.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8452,6 +8452,13 @@ int MDCache::path_traverse(const MDRequestRef& mdr, MDSContextFactory& cf,
84528452
}
84538453
}
84548454
ceph_assert(curdir);
8455+
8456+
if (mds->damage_table.is_dirfrag_damaged(curdir)) {
8457+
dout(4) << "traverse: stopped lookup at dirfrag "
8458+
<< *curdir << "/" << path[depth] << " snap=" << snapid << dendl;
8459+
return -CEPHFS_EIO;
8460+
}
8461+
84558462
if (pdir) {
84568463
*pdir = curdir;
84578464
}

0 commit comments

Comments
 (0)