mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@us.ibm.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.12-mm1] relayfs: cancel work on close/reset
Date: Wed, 22 Jun 2005 09:26:49 -0500	[thread overview]
Message-ID: <17081.29993.369456.980612@tut.ibm.com> (raw)

This patch cancels and flushes any delayed work when the channel is
closed or reset.

Andrew, please apply.

Thanks,

Tom

Signed-off-by: Tom Zanussi <zanussi@us.ibm.com>

diff -urpN -X dontdiff linux-2.6.12-mm1/fs/relayfs/relay.c linux-2.6.12-mm1-cur/fs/relayfs/relay.c
--- linux-2.6.12-mm1/fs/relayfs/relay.c	2005-06-22 11:16:23.000000000 -0500
+++ linux-2.6.12-mm1-cur/fs/relayfs/relay.c	2005-06-22 11:33:51.000000000 -0500
@@ -155,6 +155,10 @@ static inline void __relay_reset(struct 
 	if (init) {
 		init_waitqueue_head(&buf->read_wait);
 		kref_init(&buf->kref);
+		INIT_WORK(&buf->wake_readers, NULL, NULL);
+	} else {
+		cancel_delayed_work(&buf->wake_readers);
+		flush_scheduled_work();
 	}
 
 	atomic_set(&buf->subbufs_produced, 0);
@@ -171,8 +175,6 @@ static inline void __relay_reset(struct 
 
 	buf->offset = buf->chan->cb->subbuf_start(buf, buf->data, 0, NULL);
 	buf->commit[0] = buf->offset;
-
-	INIT_WORK(&buf->wake_readers, NULL, NULL);
 }
 
 /**
@@ -238,6 +240,8 @@ static inline void relay_close_buf(struc
 {
 	buf->finalized = 1;
 	buf->chan->cb = &default_channel_callbacks;
+	cancel_delayed_work(&buf->wake_readers);
+	flush_scheduled_work();
 	kref_put(&buf->kref, relay_remove_buf);
 }
 




                 reply	other threads:[~2005-06-22 14:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=17081.29993.369456.980612@tut.ibm.com \
    --to=zanussi@us.ibm.com \
    --cc=akpm@osdl.org \
    --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®