Skip to content

Commit f981e10

Browse files
committed
Merge PR ceph#24555 into master
* 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]>
2 parents e9fbb47 + 4e87709 commit f981e10

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

PendingReleaseNotes

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
necessary for clients to give up capabilities in order for the MDS to fully
1414
drop its cache. This is accomplished by asking all clients to trim as many
1515
caps as possible. The timeout argument to the `cache drop` command controls
16-
how long the MDS waits for clients to complete trimming caps. Keep in mind
17-
that clients may still retain caps to open files which will prevent the
18-
metadata for those files from being dropped by both the client and the MDS.
19-
(This is an equivalent scenario to dropping the Linux
20-
page/buffer/inode/dentry caches with some processes pinning some
21-
inodes/dentries/pages in cache.)
16+
how long the MDS waits for clients to complete trimming caps. This is optional
17+
and is 0 by default (no timeout). Keep in mind that clients may still retain
18+
caps to open files which will prevent the metadata for those files from being
19+
dropped by both the client and the MDS. (This is an equivalent scenario to
20+
dropping the Linux page/buffer/inode/dentry caches with some processes pinning
21+
some inodes/dentries/pages in cache.)
2222

2323
* The mon_health_preluminous_compat and mon_health_preluminous_compat_warning
2424
config options are removed, as the related functionality is more

src/mds/MDSDaemon.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void MDSDaemon::set_up_admin_socket()
245245
"show cache status");
246246
ceph_assert(r == 0);
247247
r = admin_socket->register_command("cache drop",
248-
"cache drop name=timeout,type=CephInt,range=1",
248+
"cache drop name=timeout,type=CephInt,range=0,req=false",
249249
asok_hook,
250250
"drop cache");
251251
ceph_assert(r == 0);
@@ -663,7 +663,7 @@ const std::vector<MDSDaemon::MDSCommand>& MDSDaemon::get_commands()
663663
MDSCommand("heap "
664664
"name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats",
665665
"show heap usage info (available only if compiled with tcmalloc)"),
666-
MDSCommand("cache drop name=timeout,type=CephInt,range=1", "trim cache and optionally request client to release all caps and flush the journal"),
666+
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"),
667667
};
668668
return commands;
669669
};

src/mds/MDSRank.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ class C_Drop_Cache : public MDSInternalContext {
276276
}
277277

278278
void start_timer() {
279+
if (!timeout) {
280+
return;
281+
}
282+
279283
timer_task = new FunctionContext([this](int _) {
280284
timer_task = nullptr;
281285
complete(-ETIMEDOUT);
@@ -2486,7 +2490,7 @@ bool MDSRankDispatcher::handle_asok_command(std::string_view command,
24862490
} else if (command == "cache drop") {
24872491
int64_t timeout;
24882492
if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) {
2489-
return false;
2493+
timeout = 0;
24902494
}
24912495

24922496
C_SaferCond cond;
@@ -3368,7 +3372,7 @@ bool MDSRankDispatcher::handle_command(
33683372
} else if (prefix == "cache drop") {
33693373
int64_t timeout;
33703374
if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) {
3371-
return false;
3375+
timeout = 0;
33723376
}
33733377

33743378
JSONFormatter *f = new JSONFormatter(true);

0 commit comments

Comments
 (0)