mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Max Kellermann <mk@cm4all.com>
To: dhowells@redhat.com, linux-cachefs@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fscache: extended "dying" check before emitting EV_INVALIDATE
Date: Wed, 03 Apr 2013 16:48:57 +0200	[thread overview]
Message-ID: <20130403144857.22351.67546.stgit@rabbit.intern.cm-ag> (raw)

Before emitting an FSCACHE_OBJECT_EV_INVALIDATE event, the function
__fscache_invalidate() checks whether the fscache_object is currently
"dying".  This checks only the current state, not the queued events
that will very soon lead to the object's death.

The problem is that fscache_object_state_machine() will
BUG("Unsupported event") when there is object->events includes
EV_INVALIDATE during "terminal_transit".  Even if we would ignore that
check, we could run into "Unexpected event in dead state" later
because object->work may still be queued.

The solution is to check for EV_RETIRE and EV_RELEASE; if one of those
two terminal events is already queued, don't bother to queue
EV_INVALIDATE.

Signed-off-by: Max Kellermann <mk@cm4all.com>
---
 fs/fscache/cookie.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 8dcb114..ed80d7f 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -402,7 +402,8 @@ void __fscache_invalidate(struct fscache_cookie *cookie)
 			object = hlist_entry(cookie->backing_objects.first,
 					     struct fscache_object,
 					     cookie_link);
-			if (object->state < FSCACHE_OBJECT_DYING)
+			if (object->state < FSCACHE_OBJECT_DYING &&
+			    (object->events & (FSCACHE_OBJECT_EV_RETIRE|FSCACHE_OBJECT_EV_RELEASE)) == 0)
 				fscache_raise_event(
 					object, FSCACHE_OBJECT_EV_INVALIDATE);
 		}


             reply	other threads:[~2013-04-03 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 14:48 Max Kellermann [this message]
2013-04-23 16:46 ` David Howells
2013-04-23 16:57 ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130403144857.22351.67546.stgit@rabbit.intern.cm-ag \
    --to=mk@cm4all.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®