From: cel@kernel.org
To: Neil Brown <neilb@suse.de>, Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: <linux-nfs@vger.kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [RFC PATCH 2/2] NFSD: Add a "file_sync" export option
Date: Wed, 6 Nov 2024 11:57:16 -0500 [thread overview]
Message-ID: <20241106165716.109681-3-cel@kernel.org> (raw)
In-Reply-To: <20241106165716.109681-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
Introduce the kernel pieces for a "file_sync" export option. This
option would make all NFS WRITE operations on one export a
FILE_SYNC WRITE.
There are two primary use cases for this new export option:
1. The exported file system is not backed by persistent storage.
Thus a subsequent COMMIT will be a no-op. To prevent the client
from wasting the extra round-trip on a COMMIT operation, convert
all WRITEs to files on that export to FILE_SYNC.
2. The exported file system is backed by persistent storage that is
faster than the mean network round trip with the client. Waiting
for a separate COMMIT operation would cost more time than just
committing the data during the WRITE operation.
Either the underlying persistent storage is faster than most any
network fabric (eg, NVMe); or the network connection to the
client is very high latency (eg, a WAN link).
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/export.c | 1 +
fs/nfsd/nfs4proc.c | 1 +
fs/nfsd/vfs.c | 5 +++--
include/uapi/linux/nfsd/export.h | 3 ++-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index c82d8e3e0d4f..11b5337dd0ea 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1297,6 +1297,7 @@ static struct flags {
{ NFSEXP_V4ROOT, {"v4root", ""}},
{ NFSEXP_PNFS, {"pnfs", ""}},
{ NFSEXP_SECURITY_LABEL, {"security_label", ""}},
+ { NFSEXP_FILE_SYNC, {"file_sync", ""}},
{ 0, {"", ""}}
};
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 51bae11d5d23..7a4ded3ff7c2 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1269,6 +1269,7 @@ nfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
status = nfsd4_clone_file_range(rqstp, src, clone->cl_src_pos,
dst, clone->cl_dst_pos, clone->cl_count,
EX_ISSYNC(cstate->current_fh.fh_export));
+ /* cel: check the "file_sync" export option as well */
nfsd_file_put(dst);
nfsd_file_put(src);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index cd00d95c997f..ffa6db6851bd 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1205,9 +1205,10 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf,
exp = fhp->fh_export;
- if (!EX_ISSYNC(exp))
+ if (exp->ex_flags & NFSEXP_FILE_SYNC)
+ *stable = NFS_FILE_SYNC;
+ else if (!EX_ISSYNC(exp))
*stable = NFS_UNSTABLE;
-
if (*stable && !fhp->fh_use_wgather)
flags |= RWF_SYNC;
diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h
index a73ca3703abb..45afec454a37 100644
--- a/include/uapi/linux/nfsd/export.h
+++ b/include/uapi/linux/nfsd/export.h
@@ -53,9 +53,10 @@
*/
#define NFSEXP_V4ROOT 0x10000
#define NFSEXP_PNFS 0x20000
+#define NFSEXP_FILE_SYNC 0x40000
/* All flags that we claim to support. (Note we don't support NOACL.) */
-#define NFSEXP_ALLFLAGS 0x3FEFF
+#define NFSEXP_ALLFLAGS 0x7FEFF
/* The flags that may vary depending on security flavor: */
#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
--
2.47.0
prev parent reply other threads:[~2024-11-06 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 16:57 [RFC PATCH 0/2] Add a "file_sync" export option cel
2024-11-06 16:57 ` [RFC PATCH 1/2] NFSD: Return the actual stable_how value to clients cel
2024-11-06 16:57 ` cel [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=20241106165716.109681-3-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=tom@talpey.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