Module Name: src
Committed By: mlelstv
Date: Fri Mar 17 00:46:35 UTC 2023
Modified Files:
src/sys/nfs: nfs_vfsops.c
Log Message:
Avoid overflow of nfs_commitsize on machines with > 32GB RAM.
To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/nfs/nfs_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/nfs/nfs_vfsops.c
diff -u src/sys/nfs/nfs_vfsops.c:1.243 src/sys/nfs/nfs_vfsops.c:1.244
--- src/sys/nfs/nfs_vfsops.c:1.243 Sun Jun 13 10:25:11 2021
+++ src/sys/nfs/nfs_vfsops.c Fri Mar 17 00:46:35 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $ */
+/* $NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@@ -1135,6 +1135,7 @@ nfs_start(struct mount *mp, int flags)
void
nfs_vfs_init(void)
{
+ unsigned scale;
/* Initialize NFS server / client shared data. */
nfs_init();
@@ -1145,7 +1146,8 @@ nfs_vfs_init(void)
/* Initialize the iod structures */
nfs_iodinit();
- nfs_commitsize = uvmexp.npages << (PAGE_SHIFT - 4);
+ scale = PAGE_SHIFT - 4;
+ nfs_commitsize = uimin(uvmexp.npages, INT_MAX >> scale) << scale;
}
void