Skip to content

Commit c7ca731

Browse files
lostjeffledhowells
authored andcommitted
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 <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Jeff Layton <[email protected]> cc: [email protected] Link: https://lore.kernel.org/r/164251399914.3435901.4761991152407411408.stgit@warthog.procyon.org.uk/ # v1
1 parent 5638b06 commit c7ca731

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/cachefiles/daemon.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,17 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
703703
return -EBUSY;
704704
}
705705

706+
/* Make sure we have copies of the tag string */
707+
if (!cache->tag) {
708+
/*
709+
* The tag string is released by the fops->release()
710+
* function, so we don't release it on error here
711+
*/
712+
cache->tag = kstrdup("CacheFiles", GFP_KERNEL);
713+
if (!cache->tag)
714+
return -ENOMEM;
715+
}
716+
706717
return cachefiles_add_cache(cache);
707718
}
708719

0 commit comments

Comments
 (0)