Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3478781ybb; Mon, 6 Apr 2020 09:41:55 -0700 (PDT) X-Google-Smtp-Source: APiQypLqwtL2DAiVN8tHmfn3kiLEN43w7sBMLal8gXhy5jE+taGzj5HfGfaCcMCCosehmQpHYppm X-Received: by 2002:a9d:600f:: with SMTP id h15mr14034564otj.275.1586191315116; Mon, 06 Apr 2020 09:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586191315; cv=none; d=google.com; s=arc-20160816; b=fXfQjamZ0EvNNuiD0D3t+D1JjE/jQQWrdXfK3/0GA4kbpf5aXiSyQ4Md6Ho5uuBvB/ r0iqQ4b90ZTY3f4onsGi2YNhVKz58tInoZsRXbUJgT63Puxqbo9qiMQEqkQQx6gOH26H VnfnM73jV2hsNM5iPSdKLCVdIVQM1OCzI13VSx1oWzkF2iwRVGjsuL04y9XGznMe9iKP ZCc+iiBkb26Hq+/3z/viWotoU5Z5F7vT/O27RcuQ/ooz8wx3VLjUlBRWIiczrobT5fNK /uGpNnKVpW69X0uu4OT98PFkDk4O6+UF8ylnWxLWWriewu5pzx5C41wKLLi+vejf+3H3 Lxog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A6G5S12nClEOGr9aNFM3fArG+QBRNh0wlse9tQQ84l8=; b=Zja7qiC8IYGv+r79uyoU3QBoX5lz34ZfOoquzu9WrkOFsXjQEq8NZb//mtgTib9alS lWmrQhPtz/yB2sxnSvG2v8JaGMsGb2+AxWj2Gm8VRxPJFDdPYk+8Lgf5/P5J7CG9AYzK aJYGovpqw5fzGVP5axXNTyWkdunazilAli+mz7VVVtFl7aCHCfzWojSpcy7hhjpmnjQg +DaqmxHIgWPVCuCcww/aWFobDIIpTCvw1TZObLXkya6hP6vxKvKH1SzImDIQ4L0LsAjf QktO+zbLVUCKM9w7GWeCxSzKl5bWd4yTicUCNzWPFjKcboSoYDEG1kSF4UfomKTiJByX H8eg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si19049otp.314.2020.04.06.09.41.41; Mon, 06 Apr 2020 09:41:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729485AbgDFQlP (ORCPT + 99 others); Mon, 6 Apr 2020 12:41:15 -0400 Received: from nautica.notk.org ([91.121.71.147]:52404 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728962AbgDFQlP (ORCPT ); Mon, 6 Apr 2020 12:41:15 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 6AB69C009; Mon, 6 Apr 2020 18:41:12 +0200 (CEST) Date: Mon, 6 Apr 2020 18:40:57 +0200 From: Dominique Martinet To: Linus Torvalds Cc: Linux Kernel Mailing List , linux-fsdevel , v9fs-developer@lists.sourceforge.net, Sergey Alirzaev Subject: Re: [GIT PULL] 9p update for 5.7 Message-ID: <20200406164057.GA18312@nautica> References: <20200406110702.GA13469@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds wrote on Mon, Apr 06, 2020: > On Mon, Apr 6, 2020 at 4:07 AM Dominique Martinet > wrote: > > - Fix read with O_NONBLOCK to allow incomplete read and return > > immediately > > Hmm. This is kind of special semantics (normally a POSIX filesystem > ignores O_NONBLOCK), but I guess it makes sense for a network > filesystem. > > It might be worth a bti more documentation/commenting because of the > special semantics. For example, since you don't have 'poll()', > O_NONBLOCK doesn't really mean "nonblocking", it means "stop earlier" > if I read that patch right. You can't just return -EAGAIN because > there's no way to then avoid busy looping.. Yes, I think you got this right. Basically there is no way to tell if the server will return immediately or not, so even with O_NONBLOCK the read() will still be 'blocking' if the server decides to wait for something before sending a reply. This patch will just make the read stop after a single round-trip with the server instead of looping to fill the buffer if O_NONBLOCK is set. The use-case here is stuff like reading from synthetic files (think fake pipes) where data comes in like a pipe and one would want read to return as soon as data is available. Just thinking out loud it might be possible to make pipes go through the server and somewhat work, but this might bring its own share of other problems and existing programs would need to be changed (e.g. wmii's synthetic filesystem exposes this kind of files as well as regular files, which works fine for their userspace client (wmiir) but can't really be used with a linux client) (Added Sergey in Cc for opinion) Anyway, I agree looking at O_NONBLOCK for that isn't obvious. I agree with the usecase here and posix allows short reads regardless of the flag so the behaviour is legal either way ; the filesystem is allowed to return whenever it wants on a whim - let's just add some docs as you suggest unless Sergey has something to add. I will add a few lines on that in Documentation/filesystems/9p.txt and send another pull request in a couple of days to give whoever wants to review time to comment on wording. Cheers, -- Dominique