Merge PR #52631 into main

* refs/pull/52631/head:
	mds: add debug logs to monitor ceph.dir.subvolume management
	mds: dump subvolume flag for inode

Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
Milind Changire 2023-09-19 13:21:09 +05:30
commit 096e82c19b
No known key found for this signature in database
GPG Key ID: 8A72967603AE8AA0
2 changed files with 14 additions and 2 deletions

View File

@ -5164,6 +5164,11 @@ void CInode::dump(Formatter *f, int flags) const
}
f->close_section();
}
auto realm = find_snaprealm();
inodeno_t subvol_ino = realm->get_subvolume_ino();
bool is_subvol = (subvol_ino && subvol_ino == ino());
f->dump_bool("is_subvolume", is_subvol);
}
/****** Scrub Stuff *****/

View File

@ -6151,6 +6151,10 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur)
inodeno_t subvol_ino = realm->get_subvolume_ino();
// can't create subvolume inside another subvolume
if (subvol_ino && subvol_ino != cur->ino()) {
dout(20) << "subvol ino changed between rdlock release and xlock "
<< "policylock; subvol_ino: " << subvol_ino << ", "
<< "cur->ino: " << cur->ino()
<< dendl;
respond_to_request(mdr, -CEPHFS_EINVAL);
return;
}
@ -6165,10 +6169,13 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur)
auto pi = cur->project_inode(mdr, false, true);
if (!srnode)
pi.snapnode->created = pi.snapnode->seq = realm->get_newest_seq();
if (val)
if (val) {
dout(20) << "marking subvolume for ino: " << cur->ino() << dendl;
pi.snapnode->mark_subvolume();
else
} else {
dout(20) << "clearing subvolume for ino: " << cur->ino() << dendl;
pi.snapnode->clear_subvolume();
}
mdr->no_early_reply = true;
pip = pi.inode.get();