svn commit: r309209 - in head/sys: fs/nfsclient fs/nullfs sys
Konstantin Belousov
kib at FreeBSD.org
Sun Nov 27 09:21:00 UTC 2016
Author: kib
Date: Sun Nov 27 09:20:58 2016
New Revision: 309209
URL: https://svnweb.freebsd.org/changeset/base/309209
Log:
NFSv4 client tracks opens, and the track records are only dropped when
the vnode is inactivated. This contradicts with the nullfs caching
which keeps upper vnode around, as consequence keeping the use
reference to lower vnode.
Add a filesystem flag to request nullfs to not cache when mounted over
that filesystem, and set the flag for nfs v4 mounts.
Reported by: asomers
Reviewed by: rmacklem
Tested by: asomers, rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/fs/nfsclient/nfs_clvfsops.c
head/sys/fs/nullfs/null_vfsops.c
head/sys/sys/mount.h
Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c Sun Nov 27 09:14:52 2016 (r309208)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c Sun Nov 27 09:20:58 2016 (r309209)
@@ -1320,6 +1320,8 @@ out:
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF |
MNTK_USES_BCACHE;
+ if ((VFSTONFS(mp)->nm_flag & NFSMNT_NFSV4) != 0)
+ mp->mnt_kern_flag |= MNTK_NULL_NOCACHE;
MNT_IUNLOCK(mp);
}
return (error);
Modified: head/sys/fs/nullfs/null_vfsops.c
==============================================================================
--- head/sys/fs/nullfs/null_vfsops.c Sun Nov 27 09:14:52 2016 (r309208)
+++ head/sys/fs/nullfs/null_vfsops.c Sun Nov 27 09:20:58 2016 (r309209)
@@ -188,7 +188,8 @@ nullfs_mount(struct mount *mp)
}
xmp->nullm_flags |= NULLM_CACHE;
- if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0)
+ if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0 ||
+ (xmp->nullm_vfs->mnt_kern_flag & MNTK_NULL_NOCACHE) != 0)
xmp->nullm_flags &= ~NULLM_CACHE;
MNT_ILOCK(mp);
Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h Sun Nov 27 09:14:52 2016 (r309208)
+++ head/sys/sys/mount.h Sun Nov 27 09:20:58 2016 (r309209)
@@ -370,7 +370,8 @@ void __mnt_vnode_markerfree_act
#define MNTK_SUSPEND 0x08000000 /* request write suspension */
#define MNTK_SUSPEND2 0x04000000 /* block secondary writes */
#define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */
-#define MNTK_UNUSED1 0x20000000
+#define MNTK_NULL_NOCACHE 0x20000000 /* auto disable cache for nullfs
+ mounts over this fs */
#define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */
#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */
More information about the svn-src-all
mailing list