From 0f31929e057742b59b3f6547660fbd5bba28f83e Mon Sep 17 00:00:00 2001 From: chencan Date: Mon, 17 Aug 2020 18:57:06 +0800 Subject: [PATCH] mds: allow quota for root directory Signed-off-by: chencan --- src/mds/MDCache.cc | 20 ++++---------------- src/mds/Server.cc | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 331d85102aaca..56aaa629747cd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2372,22 +2372,6 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob, } } - /* - * the rule here is to follow the _oldest_ parent with dirty rstat - * data. if we don't propagate all data, we add ourselves to the - * nudge list. that way all rstat data will (eventually) get - * pushed up the tree. - * - * actually, no. for now, silently drop rstats for old parents. we need - * hard link backpointers to do the above properly. - */ - - // stop? - if (pin->is_base()) - break; - parentdn = pin->get_projected_parent_dn(); - ceph_assert(parentdn); - // rstat dout(10) << "predirty_journal_parents frag->inode on " << *parent << dendl; @@ -2420,8 +2404,12 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob, parent->check_rstats(); broadcast_quota_to_client(pin); + if (pin->is_base()) + break; // next parent! cur = pin; + parentdn = pin->get_projected_parent_dn(); + ceph_assert(parentdn); parent = parentdn->get_dir(); linkunlink = 0; do_parent_mtime = false; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 77f2b561436bb..83eca15737ad4 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -5560,7 +5560,7 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur) pi.inode->layout = layout; pip = pi.inode.get(); } else if (name.compare(0, 10, "ceph.quota") == 0) { - if (!cur->is_dir() || cur->is_root()) { + if (!cur->is_dir()) { respond_to_request(mdr, -EINVAL); return; } -- 2.39.5