Skip to content

Commit

Permalink
Merge PR ceph#24555 into master
Browse files Browse the repository at this point in the history
* refs/pull/24555/head:
	doc: document optional timeout argument for `cache drop`
	mds: make timeout parameter optional for "cache drop"

Reviewed-by: Patrick Donnelly <[email protected]>
  • Loading branch information
batrick committed Nov 1, 2018
2 parents e9fbb47 + 4e87709 commit f981e10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
12 changes: 6 additions & 6 deletions PendingReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
necessary for clients to give up capabilities in order for the MDS to fully
drop its cache. This is accomplished by asking all clients to trim as many
caps as possible. The timeout argument to the `cache drop` command controls
how long the MDS waits for clients to complete trimming caps. Keep in mind
that clients may still retain caps to open files which will prevent the
metadata for those files from being dropped by both the client and the MDS.
(This is an equivalent scenario to dropping the Linux
page/buffer/inode/dentry caches with some processes pinning some
inodes/dentries/pages in cache.)
how long the MDS waits for clients to complete trimming caps. This is optional
and is 0 by default (no timeout). Keep in mind that clients may still retain
caps to open files which will prevent the metadata for those files from being
dropped by both the client and the MDS. (This is an equivalent scenario to
dropping the Linux page/buffer/inode/dentry caches with some processes pinning
some inodes/dentries/pages in cache.)

* The mon_health_preluminous_compat and mon_health_preluminous_compat_warning
config options are removed, as the related functionality is more
Expand Down
4 changes: 2 additions & 2 deletions src/mds/MDSDaemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void MDSDaemon::set_up_admin_socket()
"show cache status");
ceph_assert(r == 0);
r = admin_socket->register_command("cache drop",
"cache drop name=timeout,type=CephInt,range=1",
"cache drop name=timeout,type=CephInt,range=0,req=false",
asok_hook,
"drop cache");
ceph_assert(r == 0);
Expand Down Expand Up @@ -663,7 +663,7 @@ const std::vector<MDSDaemon::MDSCommand>& MDSDaemon::get_commands()
MDSCommand("heap "
"name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats",
"show heap usage info (available only if compiled with tcmalloc)"),
MDSCommand("cache drop name=timeout,type=CephInt,range=1", "trim cache and optionally request client to release all caps and flush the journal"),
MDSCommand("cache drop name=timeout,type=CephInt,range=0,req=false", "trim cache and optionally request client to release all caps and flush the journal"),
};
return commands;
};
Expand Down
8 changes: 6 additions & 2 deletions src/mds/MDSRank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ class C_Drop_Cache : public MDSInternalContext {
}

void start_timer() {
if (!timeout) {
return;
}

timer_task = new FunctionContext([this](int _) {
timer_task = nullptr;
complete(-ETIMEDOUT);
Expand Down Expand Up @@ -2486,7 +2490,7 @@ bool MDSRankDispatcher::handle_asok_command(std::string_view command,
} else if (command == "cache drop") {
int64_t timeout;
if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) {
return false;
timeout = 0;
}

C_SaferCond cond;
Expand Down Expand Up @@ -3368,7 +3372,7 @@ bool MDSRankDispatcher::handle_command(
} else if (prefix == "cache drop") {
int64_t timeout;
if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) {
return false;
timeout = 0;
}

JSONFormatter *f = new JSONFormatter(true);
Expand Down

0 comments on commit f981e10

Please sign in to comment.