forked from mirrors/linux
		
	fs/cachefiles: replace kerror by pr_err
Also add pr_fmt in internal.h Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									4e1eb88305
								
							
						
					
					
						commit
						0227d6abb3
					
				
					 8 changed files with 58 additions and 54 deletions
				
			
		| 
						 | 
					@ -50,18 +50,18 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
	       cache->brun_percent  < 100);
 | 
						       cache->brun_percent  < 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (*args) {
 | 
						if (*args) {
 | 
				
			||||||
		kerror("'bind' command doesn't take an argument");
 | 
							pr_err("'bind' command doesn't take an argument");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!cache->rootdirname) {
 | 
						if (!cache->rootdirname) {
 | 
				
			||||||
		kerror("No cache directory specified");
 | 
							pr_err("No cache directory specified");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* don't permit already bound caches to be re-bound */
 | 
						/* don't permit already bound caches to be re-bound */
 | 
				
			||||||
	if (test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
						if (test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
				
			||||||
		kerror("Cache already bound");
 | 
							pr_err("Cache already bound");
 | 
				
			||||||
		return -EBUSY;
 | 
							return -EBUSY;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -228,8 +228,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
 | 
				
			||||||
	set_bit(CACHEFILES_READY, &cache->flags);
 | 
						set_bit(CACHEFILES_READY, &cache->flags);
 | 
				
			||||||
	dput(root);
 | 
						dput(root);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_info("CacheFiles: File cache on %s registered\n",
 | 
						pr_info("File cache on %s registered\n", cache->cache.identifier);
 | 
				
			||||||
		cache->cache.identifier);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* check how much space the cache has */
 | 
						/* check how much space the cache has */
 | 
				
			||||||
	cachefiles_has_space(cache, 0, 0);
 | 
						cachefiles_has_space(cache, 0, 0);
 | 
				
			||||||
| 
						 | 
					@ -249,7 +248,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
 | 
				
			||||||
	kmem_cache_free(cachefiles_object_jar, fsdef);
 | 
						kmem_cache_free(cachefiles_object_jar, fsdef);
 | 
				
			||||||
error_root_object:
 | 
					error_root_object:
 | 
				
			||||||
	cachefiles_end_secure(cache, saved_cred);
 | 
						cachefiles_end_secure(cache, saved_cred);
 | 
				
			||||||
	kerror("Failed to register: %d", ret);
 | 
						pr_err("Failed to register: %d", ret);
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -261,7 +260,7 @@ void cachefiles_daemon_unbind(struct cachefiles_cache *cache)
 | 
				
			||||||
	_enter("");
 | 
						_enter("");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
						if (test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
				
			||||||
		pr_info("CacheFiles: File cache on %s unregistering\n",
 | 
							pr_info("File cache on %s unregistering\n",
 | 
				
			||||||
			cache->cache.identifier);
 | 
								cache->cache.identifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fscache_withdraw_cache(&cache->cache);
 | 
							fscache_withdraw_cache(&cache->cache);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -315,8 +315,7 @@ static unsigned int cachefiles_daemon_poll(struct file *file,
 | 
				
			||||||
static int cachefiles_daemon_range_error(struct cachefiles_cache *cache,
 | 
					static int cachefiles_daemon_range_error(struct cachefiles_cache *cache,
 | 
				
			||||||
					 char *args)
 | 
										 char *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	kerror("Free space limits must be in range"
 | 
						pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%");
 | 
				
			||||||
	       " 0%%<=stop<cull<run<100%%");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -476,12 +475,12 @@ static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
	_enter(",%s", args);
 | 
						_enter(",%s", args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!*args) {
 | 
						if (!*args) {
 | 
				
			||||||
		kerror("Empty directory specified");
 | 
							pr_err("Empty directory specified");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cache->rootdirname) {
 | 
						if (cache->rootdirname) {
 | 
				
			||||||
		kerror("Second cache directory specified");
 | 
							pr_err("Second cache directory specified");
 | 
				
			||||||
		return -EEXIST;
 | 
							return -EEXIST;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -504,12 +503,12 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
	_enter(",%s", args);
 | 
						_enter(",%s", args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!*args) {
 | 
						if (!*args) {
 | 
				
			||||||
		kerror("Empty security context specified");
 | 
							pr_err("Empty security context specified");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cache->secctx) {
 | 
						if (cache->secctx) {
 | 
				
			||||||
		kerror("Second security context specified");
 | 
							pr_err("Second security context specified");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -532,7 +531,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
	_enter(",%s", args);
 | 
						_enter(",%s", args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!*args) {
 | 
						if (!*args) {
 | 
				
			||||||
		kerror("Empty tag specified");
 | 
							pr_err("Empty tag specified");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -563,12 +562,12 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
		goto inval;
 | 
							goto inval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
						if (!test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
				
			||||||
		kerror("cull applied to unready cache");
 | 
							pr_err("cull applied to unready cache");
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (test_bit(CACHEFILES_DEAD, &cache->flags)) {
 | 
						if (test_bit(CACHEFILES_DEAD, &cache->flags)) {
 | 
				
			||||||
		kerror("cull applied to dead cache");
 | 
							pr_err("cull applied to dead cache");
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -588,11 +587,11 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
notdir:
 | 
					notdir:
 | 
				
			||||||
	path_put(&path);
 | 
						path_put(&path);
 | 
				
			||||||
	kerror("cull command requires dirfd to be a directory");
 | 
						pr_err("cull command requires dirfd to be a directory");
 | 
				
			||||||
	return -ENOTDIR;
 | 
						return -ENOTDIR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inval:
 | 
					inval:
 | 
				
			||||||
	kerror("cull command requires dirfd and filename");
 | 
						pr_err("cull command requires dirfd and filename");
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -615,7 +614,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inval:
 | 
					inval:
 | 
				
			||||||
	kerror("debug command requires mask");
 | 
						pr_err("debug command requires mask");
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -635,12 +634,12 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
		goto inval;
 | 
							goto inval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
						if (!test_bit(CACHEFILES_READY, &cache->flags)) {
 | 
				
			||||||
		kerror("inuse applied to unready cache");
 | 
							pr_err("inuse applied to unready cache");
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (test_bit(CACHEFILES_DEAD, &cache->flags)) {
 | 
						if (test_bit(CACHEFILES_DEAD, &cache->flags)) {
 | 
				
			||||||
		kerror("inuse applied to dead cache");
 | 
							pr_err("inuse applied to dead cache");
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -660,11 +659,11 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
notdir:
 | 
					notdir:
 | 
				
			||||||
	path_put(&path);
 | 
						path_put(&path);
 | 
				
			||||||
	kerror("inuse command requires dirfd to be a directory");
 | 
						pr_err("inuse command requires dirfd to be a directory");
 | 
				
			||||||
	return -ENOTDIR;
 | 
						return -ENOTDIR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inval:
 | 
					inval:
 | 
				
			||||||
	kerror("inuse command requires dirfd and filename");
 | 
						pr_err("inuse command requires dirfd and filename");
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ static int cachefiles_lookup_object(struct fscache_object *_object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ret < 0 && ret != -ETIMEDOUT) {
 | 
						if (ret < 0 && ret != -ETIMEDOUT) {
 | 
				
			||||||
		if (ret != -ENOBUFS)
 | 
							if (ret != -ENOBUFS)
 | 
				
			||||||
			pr_warn("CacheFiles: Lookup failed error %d\n", ret);
 | 
								pr_warn("Lookup failed error %d\n", ret);
 | 
				
			||||||
		fscache_object_lookup_error(&object->fscache);
 | 
							fscache_object_lookup_error(&object->fscache);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,13 @@
 | 
				
			||||||
 * 2 of the Licence, or (at your option) any later version.
 | 
					 * 2 of the Licence, or (at your option) any later version.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef pr_fmt
 | 
				
			||||||
 | 
					#undef pr_fmt
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define pr_fmt(fmt) "CacheFiles: " fmt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/fscache-cache.h>
 | 
					#include <linux/fscache-cache.h>
 | 
				
			||||||
#include <linux/timer.h>
 | 
					#include <linux/timer.h>
 | 
				
			||||||
#include <linux/wait.h>
 | 
					#include <linux/wait.h>
 | 
				
			||||||
| 
						 | 
					@ -245,11 +252,10 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * error handling
 | 
					 * error handling
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define kerror(FMT, ...) pr_err("CacheFiles: "FMT"\n", ##__VA_ARGS__)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define cachefiles_io_error(___cache, FMT, ...)		\
 | 
					#define cachefiles_io_error(___cache, FMT, ...)		\
 | 
				
			||||||
do {							\
 | 
					do {							\
 | 
				
			||||||
	kerror("I/O Error: " FMT, ##__VA_ARGS__);	\
 | 
						pr_err("I/O Error: " FMT, ##__VA_ARGS__);	\
 | 
				
			||||||
	fscache_io_error(&(___cache)->cache);		\
 | 
						fscache_io_error(&(___cache)->cache);		\
 | 
				
			||||||
	set_bit(CACHEFILES_DEAD, &(___cache)->flags);	\
 | 
						set_bit(CACHEFILES_DEAD, &(___cache)->flags);	\
 | 
				
			||||||
} while (0)
 | 
					} while (0)
 | 
				
			||||||
| 
						 | 
					@ -311,7 +317,7 @@ do {							\
 | 
				
			||||||
do {									\
 | 
					do {									\
 | 
				
			||||||
	if (unlikely(!(X))) {						\
 | 
						if (unlikely(!(X))) {						\
 | 
				
			||||||
		pr_err("\n");						\
 | 
							pr_err("\n");						\
 | 
				
			||||||
		pr_err("CacheFiles: Assertion failed\n");		\
 | 
							pr_err("Assertion failed\n");		\
 | 
				
			||||||
		BUG();							\
 | 
							BUG();							\
 | 
				
			||||||
	}								\
 | 
						}								\
 | 
				
			||||||
} while (0)
 | 
					} while (0)
 | 
				
			||||||
| 
						 | 
					@ -320,7 +326,7 @@ do {									\
 | 
				
			||||||
do {									\
 | 
					do {									\
 | 
				
			||||||
	if (unlikely(!((X) OP (Y)))) {					\
 | 
						if (unlikely(!((X) OP (Y)))) {					\
 | 
				
			||||||
		pr_err("\n");						\
 | 
							pr_err("\n");						\
 | 
				
			||||||
		pr_err("CacheFiles: Assertion failed\n");		\
 | 
							pr_err("Assertion failed\n");		\
 | 
				
			||||||
		pr_err("%lx " #OP " %lx is false\n",			\
 | 
							pr_err("%lx " #OP " %lx is false\n",			\
 | 
				
			||||||
		       (unsigned long)(X), (unsigned long)(Y));		\
 | 
							       (unsigned long)(X), (unsigned long)(Y));		\
 | 
				
			||||||
		BUG();							\
 | 
							BUG();							\
 | 
				
			||||||
| 
						 | 
					@ -331,7 +337,7 @@ do {									\
 | 
				
			||||||
do {									\
 | 
					do {									\
 | 
				
			||||||
	if (unlikely((C) && !(X))) {					\
 | 
						if (unlikely((C) && !(X))) {					\
 | 
				
			||||||
		pr_err("\n");						\
 | 
							pr_err("\n");						\
 | 
				
			||||||
		pr_err("CacheFiles: Assertion failed\n");		\
 | 
							pr_err("Assertion failed\n");		\
 | 
				
			||||||
		BUG();							\
 | 
							BUG();							\
 | 
				
			||||||
	}								\
 | 
						}								\
 | 
				
			||||||
} while (0)
 | 
					} while (0)
 | 
				
			||||||
| 
						 | 
					@ -340,7 +346,7 @@ do {									\
 | 
				
			||||||
do {									\
 | 
					do {									\
 | 
				
			||||||
	if (unlikely((C) && !((X) OP (Y)))) {				\
 | 
						if (unlikely((C) && !((X) OP (Y)))) {				\
 | 
				
			||||||
		pr_err("\n");						\
 | 
							pr_err("\n");						\
 | 
				
			||||||
		pr_err("CacheFiles: Assertion failed\n");		\
 | 
							pr_err("Assertion failed\n");		\
 | 
				
			||||||
		pr_err("%lx " #OP " %lx is false\n",			\
 | 
							pr_err("%lx " #OP " %lx is false\n",			\
 | 
				
			||||||
		       (unsigned long)(X), (unsigned long)(Y));		\
 | 
							       (unsigned long)(X), (unsigned long)(Y));		\
 | 
				
			||||||
		BUG();							\
 | 
							BUG();							\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,7 +68,7 @@ static int __init cachefiles_init(void)
 | 
				
			||||||
				  SLAB_HWCACHE_ALIGN,
 | 
									  SLAB_HWCACHE_ALIGN,
 | 
				
			||||||
				  cachefiles_object_init_once);
 | 
									  cachefiles_object_init_once);
 | 
				
			||||||
	if (!cachefiles_object_jar) {
 | 
						if (!cachefiles_object_jar) {
 | 
				
			||||||
		pr_notice("CacheFiles: Failed to allocate an object jar\n");
 | 
							pr_notice("Failed to allocate an object jar\n");
 | 
				
			||||||
		goto error_object_jar;
 | 
							goto error_object_jar;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ static int __init cachefiles_init(void)
 | 
				
			||||||
	if (ret < 0)
 | 
						if (ret < 0)
 | 
				
			||||||
		goto error_proc;
 | 
							goto error_proc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_info("CacheFiles: Loaded\n");
 | 
						pr_info("Loaded\n");
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error_proc:
 | 
					error_proc:
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ static int __init cachefiles_init(void)
 | 
				
			||||||
error_object_jar:
 | 
					error_object_jar:
 | 
				
			||||||
	misc_deregister(&cachefiles_dev);
 | 
						misc_deregister(&cachefiles_dev);
 | 
				
			||||||
error_dev:
 | 
					error_dev:
 | 
				
			||||||
	kerror("failed to register: %d", ret);
 | 
						pr_err("failed to register: %d", ret);
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,7 +95,7 @@ fs_initcall(cachefiles_init);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void __exit cachefiles_exit(void)
 | 
					static void __exit cachefiles_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pr_info("CacheFiles: Unloading\n");
 | 
						pr_info("Unloading\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cachefiles_proc_cleanup();
 | 
						cachefiles_proc_cleanup();
 | 
				
			||||||
	kmem_cache_destroy(cachefiles_object_jar);
 | 
						kmem_cache_destroy(cachefiles_object_jar);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -131,10 +131,10 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fscache_object_is_live(&object->fscache)) {
 | 
						if (fscache_object_is_live(&object->fscache)) {
 | 
				
			||||||
		pr_err("\n");
 | 
							pr_err("\n");
 | 
				
			||||||
		pr_err("CacheFiles: Error: Can't preemptively bury live object\n");
 | 
							pr_err("Error: Can't preemptively bury live object\n");
 | 
				
			||||||
		cachefiles_printk_object(object, NULL);
 | 
							cachefiles_printk_object(object, NULL);
 | 
				
			||||||
	} else if (test_and_set_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) {
 | 
						} else if (test_and_set_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) {
 | 
				
			||||||
		pr_err("CacheFiles: Error: Object already preemptively buried\n");
 | 
							pr_err("Error: Object already preemptively buried\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	write_unlock(&cache->active_lock);
 | 
						write_unlock(&cache->active_lock);
 | 
				
			||||||
| 
						 | 
					@ -157,7 +157,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
 | 
				
			||||||
	write_lock(&cache->active_lock);
 | 
						write_lock(&cache->active_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
 | 
						if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
 | 
				
			||||||
		pr_err("CacheFiles: Error: Object already active\n");
 | 
							pr_err("Error: Object already active\n");
 | 
				
			||||||
		cachefiles_printk_object(object, NULL);
 | 
							cachefiles_printk_object(object, NULL);
 | 
				
			||||||
		BUG();
 | 
							BUG();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -191,7 +191,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
 | 
				
			||||||
wait_for_old_object:
 | 
					wait_for_old_object:
 | 
				
			||||||
	if (fscache_object_is_live(&object->fscache)) {
 | 
						if (fscache_object_is_live(&object->fscache)) {
 | 
				
			||||||
		pr_err("\n");
 | 
							pr_err("\n");
 | 
				
			||||||
		pr_err("CacheFiles: Error: Unexpected object collision\n");
 | 
							pr_err("Error: Unexpected object collision\n");
 | 
				
			||||||
		cachefiles_printk_object(object, xobject);
 | 
							cachefiles_printk_object(object, xobject);
 | 
				
			||||||
		BUG();
 | 
							BUG();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -238,7 +238,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (timeout <= 0) {
 | 
							if (timeout <= 0) {
 | 
				
			||||||
			pr_err("\n");
 | 
								pr_err("\n");
 | 
				
			||||||
			pr_err("CacheFiles: Error: Overlong wait for old active object to go away\n");
 | 
								pr_err("Error: Overlong wait for old active object to go away\n");
 | 
				
			||||||
			cachefiles_printk_object(object, xobject);
 | 
								cachefiles_printk_object(object, xobject);
 | 
				
			||||||
			goto requeue;
 | 
								goto requeue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -543,7 +543,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
 | 
				
			||||||
			       next, next->d_inode, next->d_inode->i_ino);
 | 
								       next, next->d_inode, next->d_inode->i_ino);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		} else if (!S_ISDIR(next->d_inode->i_mode)) {
 | 
							} else if (!S_ISDIR(next->d_inode->i_mode)) {
 | 
				
			||||||
			kerror("inode %lu is not a directory",
 | 
								pr_err("inode %lu is not a directory",
 | 
				
			||||||
			       next->d_inode->i_ino);
 | 
								       next->d_inode->i_ino);
 | 
				
			||||||
			ret = -ENOBUFS;
 | 
								ret = -ENOBUFS;
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
| 
						 | 
					@ -574,7 +574,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
 | 
				
			||||||
		} else if (!S_ISDIR(next->d_inode->i_mode) &&
 | 
							} else if (!S_ISDIR(next->d_inode->i_mode) &&
 | 
				
			||||||
			   !S_ISREG(next->d_inode->i_mode)
 | 
								   !S_ISREG(next->d_inode->i_mode)
 | 
				
			||||||
			   ) {
 | 
								   ) {
 | 
				
			||||||
			kerror("inode %lu is not a file or directory",
 | 
								pr_err("inode %lu is not a file or directory",
 | 
				
			||||||
			       next->d_inode->i_ino);
 | 
								       next->d_inode->i_ino);
 | 
				
			||||||
			ret = -ENOBUFS;
 | 
								ret = -ENOBUFS;
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
| 
						 | 
					@ -768,7 +768,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
 | 
				
			||||||
	ASSERT(subdir->d_inode);
 | 
						ASSERT(subdir->d_inode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!S_ISDIR(subdir->d_inode->i_mode)) {
 | 
						if (!S_ISDIR(subdir->d_inode->i_mode)) {
 | 
				
			||||||
		kerror("%s is not a directory", dirname);
 | 
							pr_err("%s is not a directory", dirname);
 | 
				
			||||||
		ret = -EIO;
 | 
							ret = -EIO;
 | 
				
			||||||
		goto check_error;
 | 
							goto check_error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -795,13 +795,13 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
 | 
				
			||||||
mkdir_error:
 | 
					mkdir_error:
 | 
				
			||||||
	mutex_unlock(&dir->d_inode->i_mutex);
 | 
						mutex_unlock(&dir->d_inode->i_mutex);
 | 
				
			||||||
	dput(subdir);
 | 
						dput(subdir);
 | 
				
			||||||
	kerror("mkdir %s failed with error %d", dirname, ret);
 | 
						pr_err("mkdir %s failed with error %d", dirname, ret);
 | 
				
			||||||
	return ERR_PTR(ret);
 | 
						return ERR_PTR(ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lookup_error:
 | 
					lookup_error:
 | 
				
			||||||
	mutex_unlock(&dir->d_inode->i_mutex);
 | 
						mutex_unlock(&dir->d_inode->i_mutex);
 | 
				
			||||||
	ret = PTR_ERR(subdir);
 | 
						ret = PTR_ERR(subdir);
 | 
				
			||||||
	kerror("Lookup %s failed with error %d", dirname, ret);
 | 
						pr_err("Lookup %s failed with error %d", dirname, ret);
 | 
				
			||||||
	return ERR_PTR(ret);
 | 
						return ERR_PTR(ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nomem_d_alloc:
 | 
					nomem_d_alloc:
 | 
				
			||||||
| 
						 | 
					@ -891,7 +891,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
 | 
				
			||||||
	if (ret == -EIO) {
 | 
						if (ret == -EIO) {
 | 
				
			||||||
		cachefiles_io_error(cache, "Lookup failed");
 | 
							cachefiles_io_error(cache, "Lookup failed");
 | 
				
			||||||
	} else if (ret != -ENOMEM) {
 | 
						} else if (ret != -ENOMEM) {
 | 
				
			||||||
		kerror("Internal error: %d", ret);
 | 
							pr_err("Internal error: %d", ret);
 | 
				
			||||||
		ret = -EIO;
 | 
							ret = -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -950,7 +950,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ret != -ENOMEM) {
 | 
						if (ret != -ENOMEM) {
 | 
				
			||||||
		kerror("Internal error: %d", ret);
 | 
							pr_err("Internal error: %d", ret);
 | 
				
			||||||
		ret = -EIO;
 | 
							ret = -EIO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ int cachefiles_get_security_ID(struct cachefiles_cache *cache)
 | 
				
			||||||
		ret = set_security_override_from_ctx(new, cache->secctx);
 | 
							ret = set_security_override_from_ctx(new, cache->secctx);
 | 
				
			||||||
		if (ret < 0) {
 | 
							if (ret < 0) {
 | 
				
			||||||
			put_cred(new);
 | 
								put_cred(new);
 | 
				
			||||||
			pr_err("CacheFiles: Security denies permission to nominate security context: error %d\n",
 | 
								pr_err("Security denies permission to nominate security context: error %d\n",
 | 
				
			||||||
			       ret);
 | 
								       ret);
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -57,14 +57,14 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = security_inode_mkdir(root->d_inode, root, 0);
 | 
						ret = security_inode_mkdir(root->d_inode, root, 0);
 | 
				
			||||||
	if (ret < 0) {
 | 
						if (ret < 0) {
 | 
				
			||||||
		pr_err("CacheFiles: Security denies permission to make dirs: error %d",
 | 
							pr_err("Security denies permission to make dirs: error %d",
 | 
				
			||||||
		       ret);
 | 
							       ret);
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = security_inode_create(root->d_inode, root, 0);
 | 
						ret = security_inode_create(root->d_inode, root, 0);
 | 
				
			||||||
	if (ret < 0)
 | 
						if (ret < 0)
 | 
				
			||||||
		pr_err("CacheFiles: Security denies permission to create files: error %d",
 | 
							pr_err("Security denies permission to create files: error %d",
 | 
				
			||||||
		       ret);
 | 
							       ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ret != -EEXIST) {
 | 
						if (ret != -EEXIST) {
 | 
				
			||||||
		kerror("Can't set xattr on %*.*s [%lu] (err %d)",
 | 
							pr_err("Can't set xattr on %*.*s [%lu] (err %d)",
 | 
				
			||||||
		       dentry->d_name.len, dentry->d_name.len,
 | 
							       dentry->d_name.len, dentry->d_name.len,
 | 
				
			||||||
		       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
							       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
				
			||||||
		       -ret);
 | 
							       -ret);
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
 | 
				
			||||||
		if (ret == -ERANGE)
 | 
							if (ret == -ERANGE)
 | 
				
			||||||
			goto bad_type_length;
 | 
								goto bad_type_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		kerror("Can't read xattr on %*.*s [%lu] (err %d)",
 | 
							pr_err("Can't read xattr on %*.*s [%lu] (err %d)",
 | 
				
			||||||
		       dentry->d_name.len, dentry->d_name.len,
 | 
							       dentry->d_name.len, dentry->d_name.len,
 | 
				
			||||||
		       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
							       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
				
			||||||
		       -ret);
 | 
							       -ret);
 | 
				
			||||||
| 
						 | 
					@ -85,14 +85,14 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bad_type_length:
 | 
					bad_type_length:
 | 
				
			||||||
	kerror("Cache object %lu type xattr length incorrect",
 | 
						pr_err("Cache object %lu type xattr length incorrect",
 | 
				
			||||||
	       dentry->d_inode->i_ino);
 | 
						       dentry->d_inode->i_ino);
 | 
				
			||||||
	ret = -EIO;
 | 
						ret = -EIO;
 | 
				
			||||||
	goto error;
 | 
						goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bad_type:
 | 
					bad_type:
 | 
				
			||||||
	xtype[2] = 0;
 | 
						xtype[2] = 0;
 | 
				
			||||||
	kerror("Cache object %*.*s [%lu] type %s not %s",
 | 
						pr_err("Cache object %*.*s [%lu] type %s not %s",
 | 
				
			||||||
	       dentry->d_name.len, dentry->d_name.len,
 | 
						       dentry->d_name.len, dentry->d_name.len,
 | 
				
			||||||
	       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
						       dentry->d_name.name, dentry->d_inode->i_ino,
 | 
				
			||||||
	       xtype, type);
 | 
						       xtype, type);
 | 
				
			||||||
| 
						 | 
					@ -293,7 +293,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object,
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bad_type_length:
 | 
					bad_type_length:
 | 
				
			||||||
	kerror("Cache object %lu xattr length incorrect",
 | 
						pr_err("Cache object %lu xattr length incorrect",
 | 
				
			||||||
	       dentry->d_inode->i_ino);
 | 
						       dentry->d_inode->i_ino);
 | 
				
			||||||
	ret = -EIO;
 | 
						ret = -EIO;
 | 
				
			||||||
	goto error;
 | 
						goto error;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue