From: Trond Myklebust trond.myklebust@hammerspace.com
mainline inclusion from mainline-v5.5-rc1 commit 22a1ae9a93fb64600d0756e8f8051d65527f6786 category: bugfix bugzilla: NA CVE: NA
--------------------------------
If we set nfs_mountpoint_expiry_timeout to a negative value, then allow that to imply that we do not expire NFSv4 submounts.
Signed-off-by: Trond Myklebust trond.myklebust@hammerspace.com Signed-off-by: Zhang Xiaoxu zhangxiaoxu5@huawei.com Reviewed-by: Zhang Yi yi.zhang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/nfs/namespace.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index d57d453aecc2d..b7cac07fe0c80 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -160,6 +160,9 @@ struct vfsmount *nfs_d_automount(struct path *path) if (IS_ERR(mnt)) goto out;
+ if (nfs_mountpoint_expiry_timeout < 0) + goto out; + mntget(mnt); /* prevent immediate expiration */ mnt_set_expiry(mnt, &nfs_automount_list); schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);