diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2024-03-08 18:26:02 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2024-03-13 00:31:20 +0000 |
commit | cfa5b2a501c9062d3495aa73d5deac8a33992146 (patch) | |
tree | c9ede84488750fb88ff26322da0b1541c1103cc7 /sys/fs | |
parent | 4794e34384f00577e7eaf9dbf8be7724f3a39ef6 (diff) |
nullfs: add -o cache
(cherry picked from commit 8921216dbee6884532e22d5347cff4d9ed23e782)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nullfs/null_vfsops.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index e08ed2f55d38..6a3f77a11734 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -202,12 +202,15 @@ nullfs_mount(struct mount *mp) MNT_IUNLOCK(mp); } - xmp->nullm_flags |= NULLM_CACHE; - if (!null_cache_vnodes || - vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0 || - (xmp->nullm_vfs->mnt_kern_flag & MNTK_NULL_NOCACHE) != 0) - xmp->nullm_flags &= ~NULLM_CACHE; - + if (vfs_getopt(mp->mnt_optnew, "cache", NULL, NULL) == 0) { + xmp->nullm_flags |= NULLM_CACHE; + } else if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0) { + ; + } else if (null_cache_vnodes && + (xmp->nullm_vfs->mnt_kern_flag & MNTK_NULL_NOCACHE) == 0) { + xmp->nullm_flags |= NULLM_CACHE; + } + MNT_ILOCK(mp); if ((xmp->nullm_flags & NULLM_CACHE) != 0) { mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & |