summaryrefslogtreecommitdiff
path: root/fs/cachefiles
diff options
context:
space:
mode:
authorJeffle Xu <jefflexu@linux.alibaba.com>2022-01-14 10:30:29 +0300
committerDavid Howells <dhowells@redhat.com>2022-01-22 00:36:28 +0300
commitc7ca73155762684a896ba57edf48519b645ea528 (patch)
treefc5df843ee17dea73dd75e7990eb2a0d7d760929 /fs/cachefiles
parent5638b067d370583c6c455f019129ce33340b4142 (diff)
downloadlinux-c7ca73155762684a896ba57edf48519b645ea528.tar.xz
cachefiles: set default tag name if it's unspecified
fscache_acquire_cache() requires a non-empty name, while 'tag <name>' command is optional for cachefilesd. Thus set default tag name if it's unspecified to avoid the regression of cachefilesd. The logic is the same with that before rewritten. Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164251399914.3435901.4761991152407411408.stgit@warthog.procyon.org.uk/ # v1
Diffstat (limited to 'fs/cachefiles')
-rw-r--r--fs/cachefiles/daemon.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c
index 40a792421fc1..7ac04ee2c0a0 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -703,6 +703,17 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
return -EBUSY;
}
+ /* Make sure we have copies of the tag string */
+ if (!cache->tag) {
+ /*
+ * The tag string is released by the fops->release()
+ * function, so we don't release it on error here
+ */
+ cache->tag = kstrdup("CacheFiles", GFP_KERNEL);
+ if (!cache->tag)
+ return -ENOMEM;
+ }
+
return cachefiles_add_cache(cache);
}