s390/qdio: reset old sbal_state flags
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 16 May 2018 07:37:25 +0000 (09:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 07:26:40 +0000 (09:26 +0200)
commit 64e03ff72623b8c2ea89ca3cb660094e019ed4ae upstream.

When allocating a new AOB fails, handle_outbound() is still capable of
transmitting the selected buffer (just without async completion).

But if a previous transfer on this queue slot used async completion, its
sbal_state flags field is still set to QDIO_OUTBUF_STATE_FLAG_PENDING.
So when the upper layer driver sees this stale flag, it expects an async
completion that never happens.

Fix this by unconditionally clearing the flags field.

Fixes: 104ea556ee7f ("qdio: support asynchronous delivery of storage blocks")
Cc: <stable@vger.kernel.org> #v3.2+
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/qdio.h
drivers/s390/cio/qdio_main.c

index de11ecc99c7c46cf967a96c573f1a6c6d2cafc46..9c9970a5dfb10798ddd459dbcff7beae2d9ea42c 100644 (file)
@@ -262,7 +262,6 @@ struct qdio_outbuf_state {
        void *user;
 };
 
-#define QDIO_OUTBUF_STATE_FLAG_NONE    0x00
 #define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01
 
 #define CHSC_AC1_INITIATE_INPUTQ       0x80
index 8941e7caaf4dc9c3ae180569329457f5342d1ae8..c7afdbded26b6bfefd82dd8db3c643c5c931f857 100644 (file)
@@ -641,21 +641,20 @@ static inline unsigned long qdio_aob_for_buffer(struct qdio_output_q *q,
        unsigned long phys_aob = 0;
 
        if (!q->use_cq)
-               goto out;
+               return 0;
 
        if (!q->aobs[bufnr]) {
                struct qaob *aob = qdio_allocate_aob();
                q->aobs[bufnr] = aob;
        }
        if (q->aobs[bufnr]) {
-               q->sbal_state[bufnr].flags = QDIO_OUTBUF_STATE_FLAG_NONE;
                q->sbal_state[bufnr].aob = q->aobs[bufnr];
                q->aobs[bufnr]->user1 = (u64) q->sbal_state[bufnr].user;
                phys_aob = virt_to_phys(q->aobs[bufnr]);
                WARN_ON_ONCE(phys_aob & 0xFF);
        }
 
-out:
+       q->sbal_state[bufnr].flags = 0;
        return phys_aob;
 }