Re: [PATCH 10/20] target: Free session objects after associated commands have finished

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/13/2015 8:09 PM, Bart Van Assche wrote:
On 10/13/2015 09:41 AM, Sagi Grimberg wrote:

   void transport_free_session(struct se_session *se_sess)
   {
+    spin_lock_irq(&se_sess->sess_cmd_lock);
+    while (wait_event_interruptible_lock_irq(se_sess->cmd_list_wq,
+                list_empty(&se_sess->sess_cmd_list),
+                se_sess->sess_cmd_lock) < 0)
+        ;
+    spin_unlock_irq(&se_sess->sess_cmd_lock);
+

Can you please explain to me why not to use
wait_for_completion_interruptible() here?

Hello Sagi,

The above loop should only finish after sess_cmd_list became empty and
after target_release_cmd_kref() has unlocked the sess_cmd_lock spinlock.
target_release_cmd_kref() is not allowed to dereference the session
pointer after the above loop has finished. I had not found a way to
implement that with a single completion object without introducing race
conditions. Hence the above construct.

I see,

Another question, I notice that you wake_up cmd_list_wq even if the
session is not tearing down (where transport_free_session is not
running). Won't that introduce extra work in the hot path of command
processing?
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux