aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-02-24 05:52:51 -0500
committerDavid Howells <dhowells@redhat.com>2015-04-02 09:28:53 -0400
commit87021526300f1a292dd966e141e183630ac95317 (patch)
treea248e5643ecdf9dae6ab6a2fe0e3d4abc415b373
parentf09b443d0e09f37121c55d7f83056f6ebff6ab4f (diff)
FS-Cache: fscache_object_is_dead() has wrong logic, kill it
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>
-rw-r--r--fs/fscache/cookie.c3
-rw-r--r--fs/fscache/page.c6
-rw-r--r--include/linux/fscache-cache.h6
3 files changed, 6 insertions, 9 deletions
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 89acec742e0b..8de22164f5fb 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -327,7 +327,8 @@ static int fscache_alloc_object(struct fscache_cache *cache,
327 327
328object_already_extant: 328object_already_extant:
329 ret = -ENOBUFS; 329 ret = -ENOBUFS;
330 if (fscache_object_is_dead(object)) { 330 if (fscache_object_is_dying(object) ||
331 fscache_cache_is_broken(object)) {
331 spin_unlock(&cookie->lock); 332 spin_unlock(&cookie->lock);
332 goto error; 333 goto error;
333 } 334 }
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index de33b3fccca6..d0805e31361c 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -377,11 +377,13 @@ check_if_dead:
377 _leave(" = -ENOBUFS [cancelled]"); 377 _leave(" = -ENOBUFS [cancelled]");
378 return -ENOBUFS; 378 return -ENOBUFS;
379 } 379 }
380 if (unlikely(fscache_object_is_dead(object))) { 380 if (unlikely(fscache_object_is_dying(object) ||
381 pr_err("%s() = -ENOBUFS [obj dead %d]\n", __func__, op->state); 381 fscache_cache_is_broken(object))) {
382 enum fscache_operation_state state = op->state;
382 fscache_cancel_op(op, do_cancel); 383 fscache_cancel_op(op, do_cancel);
383 if (stat_object_dead) 384 if (stat_object_dead)
384 fscache_stat(stat_object_dead); 385 fscache_stat(stat_object_dead);
386 _leave(" = -ENOBUFS [obj dead %d]", state);
385 return -ENOBUFS; 387 return -ENOBUFS;
386 } 388 }
387 return 0; 389 return 0;
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 2e83a141e465..ca3d550da11e 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -423,12 +423,6 @@ static inline bool fscache_object_is_active(struct fscache_object *object)
423 !fscache_cache_is_broken(object); 423 !fscache_cache_is_broken(object);
424} 424}
425 425
426static inline bool fscache_object_is_dead(struct fscache_object *object)
427{
428 return fscache_object_is_dying(object) &&
429 fscache_cache_is_broken(object);
430}
431
432/** 426/**
433 * fscache_object_destroyed - Note destruction of an object in a cache 427 * fscache_object_destroyed - Note destruction of an object in a cache
434 * @cache: The cache from which the object came 428 * @cache: The cache from which the object came