aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/fs_context.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2020-01-06 15:39:37 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2020-01-15 10:54:33 -0500
commitc74dfe97c104bda5144bfa8193d8e5ea67d5da7f (patch)
tree50a1d7f2e8791c3af949391359fb1279b1073244 /fs/nfs/fs_context.c
parentNFS: Trust cached access if we've already revalidated the inode once (diff)
downloadlinux-dev-c74dfe97c104bda5144bfa8193d8e5ea67d5da7f.tar.xz
linux-dev-c74dfe97c104bda5144bfa8193d8e5ea67d5da7f.zip
NFS: Add mount option 'softreval'
Add a mount option 'softreval' that allows attribute revalidation 'getattr' calls to time out, and causes them to fall back to using the cached attributes. The use case for this option is for ensuring that we can still (slowly) traverse paths and use cached information even when the server is down. Once the server comes back up again, the getattr calls start succeeding, and the caches will revalidate as usual. The 'softreval' mount option is automatically enabled if you have specified 'softerr'. It can be turned off using the options 'nosoftreval', or 'hard'. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/fs_context.c')
-rw-r--r--fs/nfs/fs_context.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index 429315c011ae..0247dcb7b316 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -73,6 +73,7 @@ enum nfs_param {
Opt_sloppy,
Opt_soft,
Opt_softerr,
+ Opt_softreval,
Opt_source,
Opt_tcp,
Opt_timeo,
@@ -128,6 +129,7 @@ static const struct fs_parameter_spec nfs_param_specs[] = {
fsparam_flag ("sloppy", Opt_sloppy),
fsparam_flag ("soft", Opt_soft),
fsparam_flag ("softerr", Opt_softerr),
+ fsparam_flag ("softreval", Opt_softreval),
fsparam_string("source", Opt_source),
fsparam_flag ("tcp", Opt_tcp),
fsparam_u32 ("timeo", Opt_timeo),
@@ -460,11 +462,19 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
ctx->flags &= ~NFS_MOUNT_SOFTERR;
break;
case Opt_softerr:
- ctx->flags |= NFS_MOUNT_SOFTERR;
+ ctx->flags |= NFS_MOUNT_SOFTERR | NFS_MOUNT_SOFTREVAL;
ctx->flags &= ~NFS_MOUNT_SOFT;
break;
case Opt_hard:
- ctx->flags &= ~(NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR);
+ ctx->flags &= ~(NFS_MOUNT_SOFT |
+ NFS_MOUNT_SOFTERR |
+ NFS_MOUNT_SOFTREVAL);
+ break;
+ case Opt_softreval:
+ if (result.negated)
+ ctx->flags &= ~NFS_MOUNT_SOFTREVAL;
+ else
+ ctx->flags &= NFS_MOUNT_SOFTREVAL;
break;
case Opt_posix:
if (result.negated)