From d1065b0a6fd9397edd3094c56b777d0d8ec1290d Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 26 Nov 2021 14:29:06 +0000 Subject: cachefiles: Implement cache registration and withdrawal Do the following: (1) Fill out cachefiles_daemon_add_cache() so that it sets up the cache directories and registers the cache with cachefiles. (2) Add a function to do the top-level part of cache withdrawal and unregistration. (3) Add a function to sync a cache. Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/163819633175.215744.10857127598041268340.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906935445.143852.15545194974036410029.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967142904.1823006.244055483596047072.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021543872.640689.14370017789605073222.stgit@warthog.procyon.org.uk/ # v4 --- fs/cachefiles/daemon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fs/cachefiles/daemon.c') diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 7d4691614cec..a449ee661987 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c @@ -702,6 +702,7 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args) pr_warn("Cache is disabled for development\n"); return -ENOANO; // Don't allow the cache to operate yet + //return cachefiles_add_cache(cache); } /* @@ -711,10 +712,11 @@ static void cachefiles_daemon_unbind(struct cachefiles_cache *cache) { _enter(""); - if (test_bit(CACHEFILES_READY, &cache->flags)) { - // PLACEHOLDER: Withdraw cache - } + if (test_bit(CACHEFILES_READY, &cache->flags)) + cachefiles_withdraw_cache(cache); + cachefiles_put_directory(cache->graveyard); + cachefiles_put_directory(cache->store); mntput(cache->mnt); kfree(cache->rootdirname); -- cgit v1.2.3