linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "samatk@amazon.com" <samatk@amazon.com>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: Client support for 0-length virtual files
Date: Tue, 27 Feb 2024 13:56:00 +0000	[thread overview]
Message-ID: <738cec371f888a16d4d077fa41b54b8bd9d3aa1b.camel@hammerspace.com> (raw)
In-Reply-To: <A5FAB971-823E-4573-9C4B-C92BD41693E2@amazon.com>

On Tue, 2024-02-27 at 13:04 +0000, Atkinson, Sam wrote:
> Hello, I am looking for thoughts/guidance on exposing 0-byte virtual
> files (implemented with seq_file) over NFS. 
> 
> I have had success exposing these 0-byte files with nfsd and reading
> the files from a client with third-party userspace clients
> (https://github.com/CharmingYang0/NfsClient specifically), but I am
> hitting a roadblock with the Linux NFS client. When the file size is
> 0, the client seems to give up and return from the syscall before
> making a read request to the server, even when an application
> explicitly issues a syscall with a non-zero length
> (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tre
> e/fs/nfs/read.c?h=v5.10.210#n125). 
> 
> As far as I can see, there is nothing in the NFS spec indicating that
> clients should behave in this way. But I realize that making any
> change in this behavior could introduce additional round-trips
> whenever the client thinks the file length is shorter than the
> server. Could anyone share context or thoughts on why this is the
> behavior in the Linux NFS client and/or thoughts on paths forward?
> Would folks here entertain a patch proposal which removes said
> behavior, maybe configurable with a client-side module param or
> control file?
> 

If you can make it work with O_DIRECT, then have at it. However I'm not
prepared to accept any hacks to the standard cached filesystem APIs to
try to tunnel through uncacheable I/O from pseudofiles that are acting
like pipes or sockets.


The expectation for most NFS clients is that they should be able to
cache attributes as well as data, since otherwise they can cache
neither one.
Userspace clients that don't offer caching are, of course, quite free
to act differently. O_DIRECT can do the same, with certain limitations.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



      reply	other threads:[~2024-02-27 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 13:04 Client support for 0-length virtual files Atkinson, Sam
2024-02-27 13:56 ` Trond Myklebust [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=738cec371f888a16d4d077fa41b54b8bd9d3aa1b.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=samatk@amazon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).