svn commit: r282270 - in stable/10/sys: fs/ext2fs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/nfsserver fs/nullfs kern sys ufs/ffs
Rick Macklem
rmacklem at FreeBSD.org
Thu Apr 30 12:39:28 UTC 2015
Author: rmacklem
Date: Thu Apr 30 12:39:24 2015
New Revision: 282270
URL: https://svnweb.freebsd.org/changeset/base/282270
Log:
MFC: r281562
File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.
Modified:
stable/10/sys/fs/ext2fs/ext2_vfsops.c
stable/10/sys/fs/fuse/fuse_vfsops.c
stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
stable/10/sys/fs/nandfs/nandfs_vfsops.c
stable/10/sys/fs/nfsclient/nfs_clvfsops.c
stable/10/sys/fs/nfsserver/nfs_nfsdport.c
stable/10/sys/fs/nullfs/null_vfsops.c
stable/10/sys/kern/vfs_subr.c
stable/10/sys/sys/mount.h
stable/10/sys/ufs/ffs/ffs_vfsops.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- stable/10/sys/fs/ext2fs/ext2_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/ext2fs/ext2_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -661,7 +661,8 @@ ext2_mountfs(struct vnode *devvp, struct
* Initialize filesystem stat information in mount struct.
*/
MNT_ILOCK(mp);
- mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
+ mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
+ MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
return (0);
out:
Modified: stable/10/sys/fs/fuse/fuse_vfsops.c
==============================================================================
--- stable/10/sys/fs/fuse/fuse_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/fuse/fuse_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -337,6 +337,7 @@ fuse_vfsop_mount(struct mount *mp)
MNT_ILOCK(mp);
mp->mnt_data = data;
mp->mnt_flag |= MNT_LOCAL;
+ mp->mnt_kern_flag |= MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
/* We need this here as this slot is used by getnewvnode() */
mp->mnt_stat.f_iosize = PAGE_SIZE;
Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -759,6 +759,7 @@ mountmsdosfs(struct vnode *devvp, struct
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
+ mp->mnt_kern_flag |= MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
if (pmp->pm_flags & MSDOSFS_LARGEFS)
Modified: stable/10/sys/fs/nandfs/nandfs_vfsops.c
==============================================================================
--- stable/10/sys/fs/nandfs/nandfs_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/nandfs/nandfs_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -1385,6 +1385,7 @@ nandfs_mountfs(struct vnode *devvp, stru
nmp->nm_ronly = ronly;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
+ mp->mnt_kern_flag |= MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
nmp->nm_nandfsdev = nandfsdev;
/* Add our mountpoint */
Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -1193,7 +1193,8 @@ nfs_mount(struct mount *mp)
out:
if (!error) {
MNT_ILOCK(mp);
- mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF;
+ mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF |
+ MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
}
return (error);
Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -1270,8 +1270,11 @@ nfsvno_fsync(struct vnode *vp, u_int64_t
* file is done. At this time VOP_FSYNC does not accept offset and
* byte count parameters so call VOP_FSYNC the whole file for now.
* The same is true for NFSv4: RFC 3530 Sec. 14.2.3.
+ * File systems that do not use the buffer cache (as indicated
+ * by MNTK_USES_BCACHE not being set) must use VOP_FSYNC().
*/
- if (cnt == 0 || cnt > MAX_COMMIT_COUNT) {
+ if (cnt == 0 || cnt > MAX_COMMIT_COUNT ||
+ (vp->v_mount->mnt_kern_flag & MNTK_USES_BCACHE) == 0) {
/*
* Give up and do the whole thing
*/
Modified: stable/10/sys/fs/nullfs/null_vfsops.c
==============================================================================
--- stable/10/sys/fs/nullfs/null_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/fs/nullfs/null_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp)
MNTK_EXTENDED_SHARED);
}
mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
+ mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
+ MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
mp->mnt_data = xmp;
vfs_getnewfsid(mp);
Modified: stable/10/sys/kern/vfs_subr.c
==============================================================================
--- stable/10/sys/kern/vfs_subr.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/kern/vfs_subr.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -3138,6 +3138,7 @@ DB_SHOW_COMMAND(mount, db_show_mount)
MNT_KERN_FLAG(MNTK_VGONE_WAITER);
MNT_KERN_FLAG(MNTK_LOOKUP_EXCL_DOTDOT);
MNT_KERN_FLAG(MNTK_MARKER);
+ MNT_KERN_FLAG(MNTK_USES_BCACHE);
MNT_KERN_FLAG(MNTK_NOASYNC);
MNT_KERN_FLAG(MNTK_UNMOUNT);
MNT_KERN_FLAG(MNTK_MWAIT);
Modified: stable/10/sys/sys/mount.h
==============================================================================
--- stable/10/sys/sys/mount.h Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/sys/mount.h Thu Apr 30 12:39:24 2015 (r282270)
@@ -355,6 +355,7 @@ void __mnt_vnode_markerfree_act
#define MNTK_LOOKUP_EXCL_DOTDOT 0x00000800
#define MNTK_MARKER 0x00001000
#define MNTK_UNMAPPED_BUFS 0x00002000
+#define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */
#define MNTK_NOASYNC 0x00800000 /* disable async */
#define MNTK_UNMOUNT 0x01000000 /* unmount in progress */
#define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */
Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/10/sys/ufs/ffs/ffs_vfsops.c Thu Apr 30 07:00:25 2015 (r282269)
+++ stable/10/sys/ufs/ffs/ffs_vfsops.c Thu Apr 30 12:39:24 2015 (r282270)
@@ -1055,7 +1055,7 @@ ffs_mountfs(devvp, mp, td)
*/
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
- MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS;
+ MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
#ifdef UFS_EXTATTR
#ifdef UFS_EXTATTR_AUTOSTART
More information about the svn-src-stable-10
mailing list