From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org,
"Kristian Høgsberg" <krh@redhat.com>,
"Jarod Wilson" <jwilson@redhat.com>,
"Nick Piggin" <nickpiggin@yahoo.com.au>
Subject: [PATCH 1/4] firewire: fw-sbp2: use device generation, not card generation
Date: Thu, 24 Jan 2008 01:53:19 +0100 (CET) [thread overview]
Message-ID: <tkrat.a4385a83e8dc9e8d@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.288da3bd61ecfb20@s5r6.in-berlin.de>
There was a small window where a login or reconnect job could use an
already updated card generation with an outdated node ID. We have to
use the fw_device.generation here, not the fw_card.generation, because
the generation must never be newer than the node ID when we emit a
transaction. This cannot be guaranteed with fw_card.generation.
Furthermore, the target's and initiator's node IDs can be obtained from
fw_device and fw_card. Dereferencing their underlying topology objects
is not necessary.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
Rework of patch "firewire: fw-sbp2: enforce read order of device
generation and node ID" from November 1 2007.
This code also needs barriers to work precisely as intended. They will
be added by a subsequent patch which consistently updates readers and
writers of .generation and .node_id.
drivers/firewire/fw-sbp2.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -671,9 +671,9 @@ static void sbp2_login(struct work_struc
struct sbp2_login_response response;
int generation, node_id, local_node_id;
- generation = device->card->generation;
- node_id = device->node->node_id;
- local_node_id = device->card->local_node->node_id;
+ generation = device->generation;
+ node_id = device->node_id;
+ local_node_id = device->card->node_id;
if (sbp2_send_management_orb(lu, node_id, generation,
SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
@@ -921,9 +921,9 @@ static void sbp2_reconnect(struct work_s
struct fw_device *device = fw_device(unit->device.parent);
int generation, node_id, local_node_id;
- generation = device->card->generation;
- node_id = device->node->node_id;
- local_node_id = device->card->local_node->node_id;
+ generation = device->generation;
+ node_id = device->node_id;
+ local_node_id = device->card->node_id;
if (sbp2_send_management_orb(lu, node_id, generation,
SBP2_RECONNECT_REQUEST,
--
Stefan Richter
-=====-==--- ---= ==---
http://arcgraph.de/sr/
next prev parent reply other threads:[~2008-01-24 0:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-01 1:49 [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation Stefan Richter
2007-11-01 1:50 ` [PATCH] firewire: fw-core: react on bus resets while the config ROM is being fetched Stefan Richter
2007-11-01 1:51 ` [PATCH] firewire: fw-sbp2: enforce read order of device generation and node ID Stefan Richter
2007-11-01 3:53 ` [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation Nick Piggin
2007-11-01 9:51 ` dealing with barriers (was Re: [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation) Stefan Richter
2007-11-01 11:32 ` Nick Piggin
2008-01-24 0:52 ` [PATCH 0/4] firewire: order of memory accesses (bus generation vs. node ID) Stefan Richter
2008-01-24 0:53 ` Stefan Richter [this message]
2008-01-24 16:04 ` [PATCH 1/4] firewire: fw-sbp2: use device generation, not card generation Jarod Wilson
2008-01-24 0:53 ` [PATCH 2/4] firewire: fw-cdev: " Stefan Richter
2008-01-24 16:05 ` Jarod Wilson
2008-01-24 0:54 ` [PATCH 3/4] firewire: enforce access order between generation and node ID Stefan Richter
2008-01-24 4:55 ` Nick Piggin
2008-01-24 16:06 ` Jarod Wilson
2008-01-25 16:35 ` Stefan Richter
2008-01-25 17:57 ` Stefan Richter
[not found] ` <59ad55d30801251024j6ff43953tb86aaa52fdea5ec9@mail.gmail.com>
2008-01-25 22:25 ` Stefan Richter
2008-01-24 0:55 ` [PATCH 4/4] firewire: fw-core: react on bus resets while the config ROM is being fetched Stefan Richter
2008-01-24 16:11 ` Jarod Wilson
2008-01-24 19:26 ` Jarod Wilson
2008-01-25 16:53 ` [PATCH 4/4 update] " Stefan Richter
2008-01-25 17:16 ` Jarod Wilson
2008-01-25 17:21 ` Stefan Richter
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=tkrat.a4385a83e8dc9e8d@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=jwilson@redhat.com \
--cc=krh@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=nickpiggin@yahoo.com.au \
/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®