From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net
Subject: Re: [PATCH] More fixes for 2.6.0-test9
Date: Fri, 7 Nov 2003 11:27:55 -0800 [thread overview]
Message-ID: <1068233275660@kroah.com> (raw)
In-Reply-To: <10682332743672@kroah.com>
ChangeSet 1.1419, 2003/11/07 10:07:03-08:00, mdharm-usb@one-eyed-alien.net
[PATCH] USB: fix a thread-exit problem at module unload
This patch fixes a thread-exit problem when the usb-storage module is
unloaded with a preemptable kernel. Please refer to the comments in the
code for more detail.
drivers/usb/storage/usb.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c Fri Nov 7 11:22:10 2003
+++ b/drivers/usb/storage/usb.c Fri Nov 7 11:22:10 2003
@@ -417,10 +417,21 @@
scsi_unlock(host);
} /* for (;;) */
- /* notify the exit routine that we're actually exiting now */
- complete(&(us->notify));
-
- return 0;
+ /* notify the exit routine that we're actually exiting now
+ *
+ * complete()/wait_for_completion() is similar to up()/down(),
+ * except that complete() is safe in the case where the structure
+ * is getting deleted in a parallel mode of execution (i.e. just
+ * after the down() -- that's necessary for the thread-shutdown
+ * case.
+ *
+ * complete_and_exit() goes even further than this -- it is safe in
+ * the case that the thread of the caller is going away (not just
+ * the structure) -- this is necessary for the module-remove case.
+ * This is important in preemption kernels, which transfer the flow
+ * of execution immediately upon a complete().
+ */
+ complete_and_exit(&(us->notify), 0);
}
/***********************************************************************
next prev parent reply other threads:[~2003-11-07 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-07 19:26 [BK PATCH] More fixes for 2.6.0-test9 Greg KH
2003-11-07 19:27 ` [PATCH] " Greg KH
2003-11-07 19:27 ` Greg KH [this message]
2003-11-07 19:27 ` Greg KH
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=1068233275660@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.