All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
To: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	Vu Pham <vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>,
	target-devel
	<target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH-v2] ib_srpt: Initial SRP Target merge for v3.2-rc1
Date: Tue, 25 Oct 2011 23:41:38 -0700	[thread overview]
Message-ID: <1319611298.8550.58.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <CAO+b5-p-qRe_GvuB3+WWqk9d_P_1rkqB0OFvQ0Y0jTHK+oc=Zg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, 2011-10-26 at 08:09 +0200, Bart Van Assche wrote:
> On Mon, Oct 24, 2011 at 7:57 AM, Nicholas A. Bellinger
> <nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org> wrote:
> > +static int srpt_write_pending(struct se_cmd *se_cmd)
> > +{
> > +       struct srpt_rdma_ch *ch;
> > +       struct srpt_send_ioctx *ioctx;
> > +       enum srpt_command_state new_state;
> > +       enum rdma_ch_state ch_state;
> > +       int ret;
> > +
> > +       ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd);
> > +
> > +       new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA);
> > +       WARN_ON(new_state == SRPT_STATE_DONE);
> > +
> > +       ch = ioctx->ch;
> > +       BUG_ON(!ch);
> > +
> > +       ch_state = srpt_get_ch_state(ch);
> > +       switch (ch_state) {
> > +       case CH_CONNECTING:
> > +               /* This code should never be reached. */
> > +               __WARN();
> > +               ret = -EINVAL;
> > +               goto out;
> > +       case CH_LIVE:
> > +               break;
> > +       case CH_DISCONNECTING:
> > +       case CH_DRAINING:
> > +       case CH_RELEASING:
> > +               pr_debug("cmd with tag %lld: channel disconnecting\n",
> > +                        ioctx->tag);
> > +               srpt_set_cmd_state(ioctx, SRPT_STATE_DATA_IN);
> > +               ret = -EINVAL;
> > +               goto out;
> > +       }
> > +       ret = srpt_xfer_data(ch, ioctx);
> > +
> > +out:
> > +       return ret;
> > +}
> 
> If not enough memory is available to perform a SCSI write, this
> function returns -ENOMEM and the LIO core will report that error to
> the initiator. At least when mounting a filesystem on top of ib_srp
> and when performing asynchronous I/O that will result in data loss.
> Shouldn't the LIO core retry writes as long as not enough memory is
> available ?
> 
> A similar argument holds for reads.

So target_core_fabric_ops->write_pending(), ->queue_data_in() and
->queue_status() currently check for a -EAGAIN return in order to signal
that QUEUE_FULL logic should kick in for the associated se_cmd
descriptor.

I think it's reasonable to also allow fabric modules to signal
QUEUE_FULL using -ENOMEM as well, so I'll go ahead and change this for
v3.2 w/ ib_srpt and will send out a patch shortly.

Also, I did notice one extra case in srpt_map_sg_to_ib_sge() ->
srpt_xfer_data() that returns -EBUSY, so i'll change this  to -EAGAIN to
signal QUEUE_FULL as well.

Thanks for the feedback Bart!

--nab





--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2011-10-26  6:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24  5:57 [PATCH-v2] ib_srpt: Initial SRP Target merge for v3.2-rc1 Nicholas A. Bellinger
     [not found] ` <1319435841-19046-1-git-send-email-nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
2011-10-24 16:45   ` Bart Van Assche
2011-10-24 18:33     ` Nicholas A. Bellinger
2011-10-24 21:01       ` Roland Dreier
     [not found]         ` <CAG4TOxMmB13exCOx_QC6+302sS4GjhggNrTwdLi4n14=as2PWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-25  6:07           ` Bart Van Assche
2011-10-25  6:00       ` Bart Van Assche
2011-10-26  6:09   ` Bart Van Assche
     [not found]     ` <CAO+b5-p-qRe_GvuB3+WWqk9d_P_1rkqB0OFvQ0Y0jTHK+oc=Zg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-26  6:41       ` Nicholas A. Bellinger [this message]

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=1319611298.8550.58.camel@haakon2.linux-iscsi.org \
    --to=nab-izhhd5pylfbp7fqvkimdcq@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=dillowda-1Heg1YXhbW8@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    --cc=target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.