Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3200692ybh; Mon, 16 Mar 2020 18:06:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtxwFGFcMr2mJKIaOMebZXLhLEDpx6EVX6TIWrJQhDuT9fHOfoW6G/46ZP/qTyR7BvK8aXs X-Received: by 2002:aca:5ad5:: with SMTP id o204mr1685663oib.2.1584407162772; Mon, 16 Mar 2020 18:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584407162; cv=none; d=google.com; s=arc-20160816; b=dH1uigi9FkXqtzr9vzCcyYJSBBUCVQ79y8kSFsOmFy0vM2KA1nIQoxQgUwPMPDrBlh AHyjWHHAv4V5+r1lf0UFD9ncuyyODwtDTn0aG7g2OIrtrE+kwX763BoQJUUC3VTUhNr/ psVZsG+s8GRbXYVRPgW/LCQohFEND2H9n3aTatRmFDIEySsrtjdKWlW0niibT+CH70yA 4pS98cASHy5Wy8NFiaDaTQpKqwjiT9FbupqT44gpWtQM8yzdzbaekAj1Lm7mT6bObHM4 is1ZmCHEL39dsEzo7QwRyXIzQfjsbIkKkWjV6CH8HfZcJwfCS/BJ7FaIZ/hou3yrgxwN 7+iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WzwKgs3YUi5S3Lr+0bIyWMwUvtY5csa+7QWhGYR+oRI=; b=uS4w+qZAfakOTJnxZSseyhHRYC+pzymjAMFbNmf4iDKFh9vw3mS+bBW/Wlj0Ir3gMa Tl3D0sjfsljWcKErcAp972GFA9Y5+Ll5VqBgZW0bosNrCh99TClqYYCq2KEgRXl8dO3b XP6rsWH4Dr6xXuXSSLeS0Av8LXp5dym8k56CIqIoLA6brdqb3z1OfUvhF9QEE0jKSXn5 uOHz5nZk0EuWx+dnZNutyh4TP4GIlsz/S0kT3HNgT/fEGYmj32XP8YNdNGVSqKHhkZTc oNMTOFDApah9k3z/itjG9zs+IOTZta4D/1kj9BqfHHcjgeXlJdiSfANGwCFFzWnK3jvl RmGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d27si912324otf.22.2020.03.16.18.05.50; Mon, 16 Mar 2020 18:06:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733160AbgCQAp2 (ORCPT + 99 others); Mon, 16 Mar 2020 20:45:28 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:53812 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733005AbgCQAp1 (ORCPT ); Mon, 16 Mar 2020 20:45:27 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 403CF283BEE From: Gabriel Krisman Bertazi To: jdike@addtoit.com Cc: richard@nod.at, anton.ivanov@cambridgegreys.com, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com, Martyn Welch Subject: [PATCH 2/2] um: ubd: Retry buffer read on any kind of error Date: Mon, 16 Mar 2020 20:45:07 -0400 Message-Id: <20200317004507.1513370-3-krisman@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200317004507.1513370-1-krisman@collabora.com> References: <20200317004507.1513370-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Should bulk_req_safe_read return an error, we want to retry the read, otherwise, even though no IO will be done, os_write_file might still end up writing garbage to the pipe. Cc: Martyn Welch Signed-off-by: Gabriel Krisman Bertazi --- arch/um/drivers/ubd_kern.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 0f5d0a699a49..d259f0728003 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1591,11 +1591,11 @@ int io_thread(void *arg) &io_remainder_size, UBD_REQ_BUFFER_SIZE ); - if (n < 0) { - if (n == -EAGAIN) { + if (n <= 0) { + if (n == -EAGAIN) ubd_read_poll(-1); - continue; - } + + continue; } for (count = 0; count < n/sizeof(struct io_thread_req *); count++) { -- 2.25.0