diff options
author | Trond Myklebust <trondmy@gmail.com> | 2020-01-06 23:39:37 +0300 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2020-01-15 18:54:33 +0300 |
commit | c74dfe97c104bda5144bfa8193d8e5ea67d5da7f (patch) | |
tree | 50a1d7f2e8791c3af949391359fb1279b1073244 /fs/nfs/inode.c | |
parent | 5c965db86e6b0e90a3112228820598e824920278 (diff) | |
download | linux-c74dfe97c104bda5144bfa8193d8e5ea67d5da7f.tar.xz |
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/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b0b4b9f303fd..71dfc9d2fc3d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1156,7 +1156,13 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", inode->i_sb->s_id, (unsigned long long)NFS_FILEID(inode), status); - if (status == -ESTALE) { + switch (status) { + case -ETIMEDOUT: + /* A soft timeout occurred. Use cached information? */ + if (server->flags & NFS_MOUNT_SOFTREVAL) + status = 0; + break; + case -ESTALE: nfs_zap_caches(inode); if (!S_ISDIR(inode->i_mode)) set_bit(NFS_INO_STALE, &NFS_I(inode)->flags); |