Skip to content

Commit

Permalink
Merge PR ceph#21997 into master
Browse files Browse the repository at this point in the history
* refs/pull/21997/head:
	mds: broadcast quota to relevant clients when quota is explicitly set

Reviewed-by: Zheng Yan <[email protected]>
  • Loading branch information
batrick committed May 20, 2018
2 parents ca40b1c + b2a7643 commit af129d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ void MDCache::project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accou
}
}

void MDCache::broadcast_quota_to_client(CInode *in)
void MDCache::broadcast_quota_to_client(CInode *in, client_t exclude_ct)
{
if (!(mds->is_active() || mds->is_stopping()))
return;
Expand All @@ -2026,6 +2026,10 @@ void MDCache::broadcast_quota_to_client(CInode *in)
continue;

Capability *cap = it->second;

if (exclude_ct >= 0 && exclude_ct != it->first)
goto update;

if (cap->last_rbytes == i->rstat.rbytes &&
cap->last_rsize == i->rstat.rsize())
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class MDCache {
void project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accounted_rstat,
snapid_t ofirst, snapid_t last,
CInode *pin, bool cow_head);
void broadcast_quota_to_client(CInode *in);
void broadcast_quota_to_client(CInode *in, client_t exclude_ct = -1);
void predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
CInode *in, CDir *parent,
int flags, int linkunlink=0,
Expand Down
3 changes: 3 additions & 0 deletions src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4851,6 +4851,9 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur,
}
mdr->no_early_reply = true;
pip = &pi.inode;

client_t exclude_ct = mdr->get_client();
mdcache->broadcast_quota_to_client(cur, exclude_ct);
} else if (name.find("ceph.dir.pin") == 0) {
if (!cur->is_dir() || cur->is_root()) {
respond_to_request(mdr, -EINVAL);
Expand Down

0 comments on commit af129d1

Please sign in to comment.