FS-Cache: Limit the number of I/O error reports for a cache
authorDavid Howells <dhowells@redhat.com>
Wed, 5 Dec 2012 13:34:48 +0000 (13:34 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 20 Dec 2012 22:10:44 +0000 (22:10 +0000)
Limit the number of I/O error reports for a cache to 1 to prevent massive
amounts of noise.  After the first I/O error the cache is taken off line
automatically, so must be restarted to resume caching.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/fscache/cache.c

index 6a3c48abd677f52eb2bd10a5bb89108cd5d89d0a..b52aed1dca97fc5769d43a34f8e51de2e28fd653 100644 (file)
@@ -314,10 +314,10 @@ EXPORT_SYMBOL(fscache_add_cache);
  */
 void fscache_io_error(struct fscache_cache *cache)
 {
-       set_bit(FSCACHE_IOERROR, &cache->flags);
-
-       printk(KERN_ERR "FS-Cache: Cache %s stopped due to I/O error\n",
-              cache->ops->name);
+       if (!test_and_set_bit(FSCACHE_IOERROR, &cache->flags))
+               printk(KERN_ERR "FS-Cache:"
+                      " Cache '%s' stopped due to I/O error\n",
+                      cache->ops->name);
 }
 EXPORT_SYMBOL(fscache_io_error);