Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp69744ybv; Tue, 4 Feb 2020 16:36:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxNZwPJG+7azN+fOeKMwk2h6EfxiikOvKQs7NCa228aRm/ZG27i6Zbif5JY899vdCWW4xhr X-Received: by 2002:a05:6830:155a:: with SMTP id l26mr24310312otp.339.1580863012641; Tue, 04 Feb 2020 16:36:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580863012; cv=none; d=google.com; s=arc-20160816; b=wbscHdSTgHnYBiGYSjzbwm47P2QKS/VuRo61sXwc8kVNH18zH/Q4R2nXfkLY7aPfbd ngwTtr5RgHvvwqS6aYL1D2QQ//goE/TbnqvdpXRN/a0RMLYjQA85ad+Be5Dnh4Nmkr/s Y8ys99JMj0rdVDAkGToOnflbfX1J9iXMcMKYF1phcsbW/D6ffhSPa+xKSB4TzuXoyzjU yQirVCtFhUdcM3tqvnEljRQBrMazmh+Rud+CAMBhAUX7RVoRIXquDQbHgOgfCGRELifJ ht11hV67guJuPTmRnasLpXfBvkzpzYWZ6BdhmD5KDxQDvZFXDChGETy9mnEm+o5m375n Ei0Q== 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:dkim-signature :from; bh=DM4kDaOsb2DuV+kjY+blsOGJiY10P8x5wmeDe51N59I=; b=mupNzuSOvUUYZwGa5w5XgZ3TIkKb2MMbqJJkf6vg68zgkRYTaTxaMgGurRLmLKgo9y GaY+V0DGDFTfuEA8Vd+4azZkqoJtBr8GbIZo0bn6+AiFMg7pTKSRaayBSZ8kGtc4G6cZ g5rQoNkg2ic5JF/XMlICPcr/ihPTxZD0AiVK1MLGJVSjwTTgMdrn4eXCYJLfIKEWLlaU 1zqvxBPMTI2f+MU41VJWt2Z6LgIWZQ02EOBX1CRdvm0upLc0G0MMWT1nsytiay7zHsPF e3HM1t0NdvClNVCL3IIVXp1oOVoMXcxvjK1HLW3lFyDLtRAXqzIQAN0qKwzyx8hC3wwm Ft5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cock.li header.s=mail header.b="knpvXt/S"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si12131967otg.309.2020.02.04.16.36.40; Tue, 04 Feb 2020 16:36:52 -0800 (PST) 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; dkim=pass header.i=@cock.li header.s=mail header.b="knpvXt/S"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727758AbgBEAfr (ORCPT + 99 others); Tue, 4 Feb 2020 19:35:47 -0500 Received: from mx1.cock.li ([185.10.68.5]:60785 "EHLO cock.li" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727627AbgBEAfr (ORCPT ); Tue, 4 Feb 2020 19:35:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on cock.li X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NO_RECEIVED,NO_RELAYS shortcircuit=_SCTYPE_ autolearn=disabled version=3.4.2 From: Sergey Alirzaev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cock.li; s=mail; t=1580862943; bh=Hjws4hd6gO2//6ej+Q1oLOrL7jmkiZKIXGuthMfEYqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=knpvXt/SYh3/6+DkvT/RYVyVwKyKqP/J1WLMVs3qP/R++J9A2mtZwIjjvtJ+MN2bQ RPoGVCnorvJAyGWi7TMoFHUM6NGBdUXi+mvX9iws//EgMbGGoh1lDdfcbzCOdQ7jo4 Tnb5CJldbRPd0ul46RllaNuUEHWk/V+GGAVJTVYs2gXiYkiNpi9EXJeYJkFkCK5mQa 6jwTP1VU3bw4b6GV1vCe3OAweiRo5yudSefxBK/A3jqcvpYelAt/JYEW/BOe6XyBpZ Bwrj+uL4xBSfVGZNAN9N0VQ1sfdv0psNuGfwbs7dLeF+inGP4LOFs/i6RFbrSY9F01 4XnN3SCgmrXJg== To: v9fs-developer@lists.sourceforge.net Cc: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Alirzaev Subject: [PATCH 2/2] 9p: read only once on O_NONBLOCK Date: Wed, 5 Feb 2020 03:34:57 +0300 Message-Id: <20200205003457.24340-2-l29ah@cock.li> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200205003457.24340-1-l29ah@cock.li> References: <20200205003457.24340-1-l29ah@cock.li> 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 A proper way to handle O_NONBLOCK would be making the requests and responses happen asynchronously, but this would require serious code refactoring. Signed-off-by: Sergey Alirzaev --- fs/9p/vfs_file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index fe7f0bd2048e..92cd1d80218d 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -388,7 +388,10 @@ v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", iov_iter_count(to), iocb->ki_pos); - ret = p9_client_read(fid, iocb->ki_pos, to, &err); + if (iocb->ki_filp->f_flags & O_NONBLOCK) + ret = p9_client_read_once(fid, iocb->ki_pos, to, &err); + else + ret = p9_client_read(fid, iocb->ki_pos, to, &err); if (!ret) return err; -- 2.25.0