Thread (21 messages) 21 messages, 2 authors, 2012-01-23

Re: [PATCH v3 12/14] isci: ->lldd_ata_check_ready handler

From: Dan Williams <hidden>
Date: 2012-01-09 19:26:36
Also in: linux-scsi

On Sun, Jan 8, 2012 at 5:57 PM, Jack Wang [off-list ref] wrote:
quoted
+int isci_ata_check_ready(struct domain_device *dev)
+{
+     struct isci_port *iport = dev->port->lldd_port;
+     struct isci_host *ihost = dev_to_ihost(dev);
+     struct isci_remote_device *idev;
+     unsigned long flags;
+     int rc = 0;
+
+     spin_lock_irqsave(&ihost->scic_lock, flags);
+     idev = isci_lookup_device(dev);
+     spin_unlock_irqrestore(&ihost->scic_lock, flags);
+
+     if (!idev)
+             goto out;
+
+     if (test_bit(IPORT_RESET_PENDING, &iport->state))
+             goto out;
+
+     /* snapshot active phy mask */
+     spin_lock_irqsave(&ihost->scic_lock, flags);
+     rc = !!iport->active_phy_mask;
[Jack Wang]
Hi Dan,

Could you explain why here you not directly use "
rc = !!iport->active_phy_mask;
You are right, it can look at the field outside the lock... and since
we have already taken the lock to get a device reference we know we
have flushed any recent port events.

--
Dan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help