]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
FS-Cache: fscache_object_is_dead() has wrong logic, kill it
authorDavid Howells <dhowells@redhat.com>
Tue, 24 Feb 2015 10:52:51 +0000 (10:52 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 2 Apr 2015 13:28:53 +0000 (14:28 +0100)
fscache_object_is_dead() returns true only if the object is marked dead and
the cache got an I/O error.  This should be a logical OR instead.  Since two
of the callers got split up into handling for separate subcases, expand the
other callers and kill the function.  This is probably the right thing to do
anyway since one of the subcases isn't about the object at all, but rather
about the cache.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Acked-by: Jeff Layton <jeff.layton@primarydata.com>
fs/fscache/cookie.c
fs/fscache/page.c
include/linux/fscache-cache.h

index 89acec742e0bfdb2b1aab30e31991655462f05d9..8de22164f5fb1f9a49d62559e42880115789bfda 100644 (file)
@@ -327,7 +327,8 @@ static int fscache_alloc_object(struct fscache_cache *cache,
 
 object_already_extant:
        ret = -ENOBUFS;
-       if (fscache_object_is_dead(object)) {
+       if (fscache_object_is_dying(object) ||
+           fscache_cache_is_broken(object)) {
                spin_unlock(&cookie->lock);
                goto error;
        }
index de33b3fccca650da99ee850597d5aef437b3a6fe..d0805e31361cb9328714440cccc3f4e3f908cbce 100644 (file)
@@ -377,11 +377,13 @@ check_if_dead:
                _leave(" = -ENOBUFS [cancelled]");
                return -ENOBUFS;
        }
-       if (unlikely(fscache_object_is_dead(object))) {
-               pr_err("%s() = -ENOBUFS [obj dead %d]\n", __func__, op->state);
+       if (unlikely(fscache_object_is_dying(object) ||
+                    fscache_cache_is_broken(object))) {
+               enum fscache_operation_state state = op->state;
                fscache_cancel_op(op, do_cancel);
                if (stat_object_dead)
                        fscache_stat(stat_object_dead);
+               _leave(" = -ENOBUFS [obj dead %d]", state);
                return -ENOBUFS;
        }
        return 0;
index 2e83a141e465c3e59e91a615e3c1ad2e9aa3fa35..ca3d550da11eab11dba469fe06d1bcaf1c9f3f1e 100644 (file)
@@ -423,12 +423,6 @@ static inline bool fscache_object_is_active(struct fscache_object *object)
                !fscache_cache_is_broken(object);
 }
 
-static inline bool fscache_object_is_dead(struct fscache_object *object)
-{
-       return fscache_object_is_dying(object) &&
-               fscache_cache_is_broken(object);
-}
-
 /**
  * fscache_object_destroyed - Note destruction of an object in a cache
  * @cache: The cache from which the object came