Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/srpt: Report login failures only once

Report the following message only once if no ACL has been configured
yet for an initiator port:

"Rejected login because no ACL has been configured yet for initiator %s.\n"

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagig@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Bart Van Assche and committed by
Doug Ledford
0d38c240 5f4c7e4e

+9 -13
+9 -13
drivers/infiniband/ulp/srpt/ib_srpt.c
··· 1840 1840 struct srpt_rdma_ch *ch, *tmp_ch; 1841 1841 u32 it_iu_len; 1842 1842 int i, ret = 0; 1843 - unsigned char *p; 1844 1843 1845 1844 WARN_ON_ONCE(irqs_disabled()); 1846 1845 ··· 1993 1994 be64_to_cpu(*(__be64 *)(ch->i_port_id + 8))); 1994 1995 1995 1996 pr_debug("registering session %s\n", ch->sess_name); 1996 - p = &ch->sess_name[0]; 1997 1997 1998 - try_again: 1999 1998 ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0, 2000 - TARGET_PROT_NORMAL, p, ch, NULL); 1999 + TARGET_PROT_NORMAL, ch->sess_name, ch, 2000 + NULL); 2001 + /* Retry without leading "0x" */ 2002 + if (IS_ERR(ch->sess)) 2003 + ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0, 2004 + TARGET_PROT_NORMAL, 2005 + ch->sess_name + 2, ch, NULL); 2001 2006 if (IS_ERR(ch->sess)) { 2002 - pr_info("Rejected login because no ACL has been" 2003 - " configured yet for initiator %s.\n", p); 2004 - /* 2005 - * XXX: Hack to retry of ch->i_port_id without leading '0x' 2006 - */ 2007 - if (p == &ch->sess_name[0]) { 2008 - p += 2; 2009 - goto try_again; 2010 - } 2007 + pr_info("Rejected login because no ACL has been configured yet for initiator %s.\n", 2008 + ch->sess_name); 2011 2009 rej->reason = cpu_to_be32((PTR_ERR(ch->sess) == -ENOMEM) ? 2012 2010 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES : 2013 2011 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED);