Re: deadlocks when the target server runs as initiator to itself

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

 



po 30. 1. 2023 v 1:09 odesílatel Mike Christie
<michael.christie@xxxxxxxxxx> napsal:
>
> I don't think that's the best option because it's a rare use case and it
> will affect other users. Why can't the user just use tcm loop for the local
> use case?
>

Hi Mike,
our customer is still interested in getting iscsi in loopback work and I have
also been informed that  this use case isn't rare among our users.
One of my colleagues suggested using the IFF_LOOPBACK flag to restrict
the memalloc_noio_*()
usage to only those connections that are in loopback, so other use
cases would be left unaffected.

I copy-paste his patch here, our customer confirmed that it works.

--- a/drivers/target/iscsi/iscsi_target.c 2023-01-30 13:48:43.310455860 -0500
+++ b/drivers/target/iscsi/iscsi_target.c 2023-01-30 17:10:08.171410784 -0500
@@ -24,6 +24,7 @@
 #include <linux/vmalloc.h>
 #include <linux/idr.h>
 #include <linux/delay.h>
+#include <linux/sched/mm.h>
 #include <linux/sched/signal.h>
 #include <asm/unaligned.h>
 #include <linux/inet.h>
@@ -4043,7 +4044,10 @@ int iscsi_target_rx_thread(void *arg)
 {
  int rc;
  struct iscsi_conn *conn = arg;
+ struct dst_entry *dst;
  bool conn_freed = false;
+ bool local = false;
+ unsigned int flags;

  /*
  * Allow ourselves to be interrupted by SIGINT so that a
@@ -4061,7 +4065,17 @@ int iscsi_target_rx_thread(void *arg)
  if (!conn->conn_transport->iscsit_get_rx_pdu)
  return 0;

+ rcu_read_lock();
+ dst = rcu_dereference(conn->sock->sk->sk_dst_cache);
+ if (dst && dst->dev && dst->dev->flags & IFF_LOOPBACK)
+         local = true;
+ rcu_read_unlock();
+
+ if (local)
+         flags = memalloc_noio_save();
  conn->conn_transport->iscsit_get_rx_pdu(conn);
+ if (local)
+         memalloc_noio_restore(flags);





[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