summaryrefslogtreecommitdiffstats
path: root/src/mds/Server.cc
diff options
context:
space:
mode:
authorPatrick Donnelly <pdonnell@redhat.com>2024-01-26 22:36:53 +0100
committerPatrick Donnelly <pdonnell@redhat.com>2024-03-20 15:56:55 +0100
commite2529fc74808b102b1ca85a3ee6644160da32e60 (patch)
tree832108ae58c21742bbf71891b5a8ff591f710b06 /src/mds/Server.cc
parentmds: convert encoded ephemeral dist pin to flags (diff)
downloadceph-e2529fc74808b102b1ca85a3ee6644160da32e60.tar.xz
ceph-e2529fc74808b102b1ca85a3ee6644160da32e60.zip
mds: add vxattr to block quiesce on an inode
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Diffstat (limited to 'src/mds/Server.cc')
-rw-r--r--src/mds/Server.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 3bc4f9196b6..04330cd308d 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -6175,6 +6175,57 @@ void Server::handle_set_vxattr(const MDRequestRef& mdr, CInode *cur)
client_t exclude_ct = mdr->get_client();
mdcache->broadcast_quota_to_client(cur, exclude_ct, true);
+ } else if (name == "ceph.quiesce.block"sv) {
+ bool val;
+ try {
+ val = boost::lexical_cast<bool>(value);
+ } catch (boost::bad_lexical_cast const&) {
+ dout(10) << "bad vxattr value, unable to parse bool for " << name << dendl;
+ respond_to_request(mdr, -CEPHFS_EINVAL);
+ return;
+ }
+
+ /* Verify it's not already marked with lighter weight
+ * rdlock.
+ */
+ if (!mdr->more()->rdonly_checks) {
+ if (!(mdr->locking_state & MutationImpl::ALL_LOCKED)) {
+ lov.add_rdlock(&cur->policylock);
+ if (!mds->locker->acquire_locks(mdr, lov))
+ return;
+ mdr->locking_state |= MutationImpl::ALL_LOCKED;
+ }
+ bool is_blocked = cur->get_projected_inode()->get_quiesce_block();
+ if (is_blocked == val) {
+ dout(20) << "already F_QUIESCE_BLOCK set" << dendl;
+ respond_to_request(mdr, 0);
+ return;
+ }
+ mdr->more()->rdonly_checks = true;
+ }
+
+ if ((mdr->locking_state & MutationImpl::ALL_LOCKED) && !mdr->is_xlocked(&cur->policylock)) {
+ /* drop the rdlock and acquire xlocks */
+ dout(20) << "dropping rdlocks" << dendl;
+ mds->locker->drop_locks(mdr.get());
+ if (!xlock_policylock(mdr, cur, false, true))
+ return;
+ }
+
+ /* repeat rdonly checks in case changed between rdlock -> xlock */
+ bool is_blocked = cur->get_projected_inode()->get_quiesce_block();
+ if (is_blocked == val) {
+ dout(20) << "already F_QUIESCE_BLOCK set" << dendl;
+ respond_to_request(mdr, 0);
+ return;
+ }
+
+ auto pi = cur->project_inode(mdr);
+ pi.inode->set_quiesce_block(val);
+ dout(20) << (val ? "setting" : "unsetting") << " F_QUIESCE_BLOCK on ino: " << cur->ino() << dendl;
+
+ mdr->no_early_reply = true;
+ pip = pi.inode.get();
} else if (name == "ceph.dir.subvolume"sv) {
if (!cur->is_dir()) {
respond_to_request(mdr, -CEPHFS_EINVAL);
@@ -6879,6 +6930,8 @@ void Server::handle_client_getvxattr(const MDRequestRef& mdr)
} else {
r = -CEPHFS_ENODATA; // no such attribute
}
+ } else if (xattr_name == "ceph.quiesce.block"sv) {
+ *css << cur->get_projected_inode()->get_quiesce_block();
} else if (xattr_name.substr(0, 12) == "ceph.dir.pin"sv) {
if (xattr_name == "ceph.dir.pin"sv) {
*css << cur->get_projected_inode()->export_pin;