2021-02-12 21:52:47

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 0/3] Add a mount option to support eager writes

From: Trond Myklebust <[email protected]>

The following patch series sets up a new mount option
'writes=lazy/eager/wait'. The mount option basically controls how the
write() system call works.
- writes=lazy is the default, and keeps the current behaviour
- writes=eager means we send off the write immediately as an unstable
write to the server.
- writes=wait means we send off the write as an unstable write, and then
wait for the reply.

The main motivator for this behaviour is that some applications expect
write() to return ENOSPC. Setting writes=wait should satisfy those
applications without taking the full overhead of a synchronous write.

writes=eager, on the other hand, can be useful for applications such as
re-exporting NFS, since it would allow knfsd on the proxying server to
immediately forward the writes to the original server.

Trond Myklebust (3):
NFS: 'flags' field should be unsigned in struct nfs_server
NFS: Add support for eager writes
NFS: Add mount options supporting eager writes

fs/nfs/file.c | 19 +++++++++++++++++--
fs/nfs/fs_context.c | 33 +++++++++++++++++++++++++++++++++
fs/nfs/write.c | 17 ++++++++++++-----
include/linux/nfs_fs_sb.h | 4 +++-
4 files changed, 65 insertions(+), 8 deletions(-)

--
2.29.2


2021-02-12 21:53:00

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 1/3] NFS: 'flags' field should be unsigned in struct nfs_server

From: Trond Myklebust <[email protected]>

The mount flags are all unsigned integers, so we should not be storing
them in a signed field.

Signed-off-by: Trond Myklebust <[email protected]>
---
include/linux/nfs_fs_sb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 38e60ec742df..962e8313f007 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -142,7 +142,7 @@ struct nfs_server {
struct nlm_host *nlm_host; /* NLM client handle */
struct nfs_iostats __percpu *io_stats; /* I/O statistics */
atomic_long_t writeback; /* number of writeback pages */
- int flags; /* various flags */
+ unsigned int flags; /* various flags */

/* The following are for internal use only. Also see uapi/linux/nfs_mount.h */
#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
--
2.29.2

2021-02-13 14:20:42

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 0/3] Add a mount option to support eager writes

Hey!

On 2/12/21 4:49 PM, [email protected] wrote:
> From: Trond Myklebust <[email protected]>
>
> The following patch series sets up a new mount option
> 'writes=lazy/eager/wait'. The mount option basically controls how the
> write() system call works.
> - writes=lazy is the default, and keeps the current behaviour
> - writes=eager means we send off the write immediately as an unstable
> write to the server.
> - writes=wait means we send off the write as an unstable write, and then
> wait for the reply.
>
> The main motivator for this behaviour is that some applications expect
> write() to return ENOSPC. Setting writes=wait should satisfy those
> applications without taking the full overhead of a synchronous write.
>
> writes=eager, on the other hand, can be useful for applications such as
> re-exporting NFS, since it would allow knfsd on the proxying server to
> immediately forward the writes to the original server.
>
> Trond Myklebust (3):
> NFS: 'flags' field should be unsigned in struct nfs_server
> NFS: Add support for eager writes
> NFS: Add mount options supporting eager writes
>
> fs/nfs/file.c | 19 +++++++++++++++++--
> fs/nfs/fs_context.c | 33 +++++++++++++++++++++++++++++++++
> fs/nfs/write.c | 17 ++++++++++++-----
> include/linux/nfs_fs_sb.h | 4 +++-
> 4 files changed, 65 insertions(+), 8 deletions(-)
>
Shouldn't something be added to the nfs(5) man page
as well as blurb added to /etc/nfsmount.conf file?

steved.

2021-02-13 14:22:17

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH 0/3] Add a mount option to support eager writes

On Sat, 2021-02-13 at 09:19 -0500, Steve Dickson wrote:
> Hey!
>
> On 2/12/21 4:49 PM, [email protected] wrote:
> > From: Trond Myklebust <[email protected]>
> >
> > The following patch series sets up a new mount option
> > 'writes=lazy/eager/wait'. The mount option basically controls how
> > the
> > write() system call works.
> > - writes=lazy is the default, and keeps the current behaviour
> > - writes=eager means we send off the write immediately as an
> > unstable
> >   write to the server.
> > - writes=wait means we send off the write as an unstable write, and
> > then
> >   wait for the reply.
> >
> > The main motivator for this behaviour is that some applications
> > expect
> > write() to return ENOSPC. Setting writes=wait should satisfy those
> > applications without taking the full overhead of a synchronous
> > write.
> >
> > writes=eager, on the other hand, can be useful for applications
> > such as
> > re-exporting NFS, since it would allow knfsd on the proxying server
> > to
> > immediately forward the writes to the original server.
> >
> > Trond Myklebust (3):
> >   NFS: 'flags' field should be unsigned in struct nfs_server
> >   NFS: Add support for eager writes
> >   NFS: Add mount options supporting eager writes
> >
> >  fs/nfs/file.c             | 19 +++++++++++++++++--
> >  fs/nfs/fs_context.c       | 33 +++++++++++++++++++++++++++++++++
> >  fs/nfs/write.c            | 17 ++++++++++++-----
> >  include/linux/nfs_fs_sb.h |  4 +++-
> >  4 files changed, 65 insertions(+), 8 deletions(-)
> >
> Shouldn't something be added to the nfs(5) man page
> as well as blurb added to /etc/nfsmount.conf file?
>

Sure, but I'd like comments/consensus on the kernel bits first. ????

Cheers
Trond

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]