Module Name: src Committed By: riastradh Date: Thu Apr 9 19:47:05 UTC 2015
Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: zfs_znode.h src/tests/fs/vfs: t_vnops.c Log Message: Advisory locking for zfs. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c cvs rdiff -u -r1.6 -r1.7 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h cvs rdiff -u -r1.48 -r1.49 src/tests/fs/vfs/t_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.19 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.20 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.19 Thu Apr 9 19:35:55 2015 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Thu Apr 9 19:47:05 2015 @@ -5674,6 +5674,36 @@ zfs_netbsd_pathconf(void *v) #define zfs_netbsd_unlock genfs_unlock #define zfs_netbsd_islocked genfs_islocked +static int +zfs_netbsd_advlock(void *v) +{ + struct vop_advlock_args /* { + struct vnode *a_vp; + void *a_id; + int a_op; + struct flock *a_fl; + int a_flags; + } */ *ap = v; + struct vnode *vp; + struct znode *zp; + struct zfsvfs *zfsvfs; + int error; + + vp = ap->a_vp; + KASSERT(vp != NULL); + zp = VTOZ(vp); + KASSERT(zp != NULL); + zfsvfs = zp->z_zfsvfs; + KASSERT(zfsvfs != NULL); + + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + error = lf_advlock(ap, &zp->z_lockf, zp->z_phys->zp_size); + ZFS_EXIT(zfsvfs); + + return error; +} + /* int zfs_netbsd_getpages(void *v) @@ -5753,8 +5783,8 @@ const struct vnodeopv_entry_desc zfs_vno { &vop_putpages_desc, zfs_netbsd_putpages }, { &vop_mmap_desc, zfs_netbsd_mmap }, { &vop_islocked_desc, zfs_netbsd_islocked }, -#ifdef notyet { &vop_advlock_desc, zfs_netbsd_advlock }, +#ifdef notyet { &vop_fcntl_desc, zfs_netbsd_fcntl }, { &vop_bmap_desc, zfs_netbsd_bmap }, { &vop_strategy_desc, zfs_netbsd_strategy }, Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.7 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h:1.6 Fri Dec 5 09:13:32 2014 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h Thu Apr 9 19:47:05 2015 @@ -222,6 +222,10 @@ typedef struct znode { */ znode_phys_t *z_phys; /* pointer to persistent znode */ dmu_buf_t *z_dbuf; /* buffer containing the z_phys */ + /* + * NetBSD-specific fields. + */ + struct lockf *z_lockf; /* Head of byte-level lock list. */ } znode_t; Index: src/tests/fs/vfs/t_vnops.c diff -u src/tests/fs/vfs/t_vnops.c:1.48 src/tests/fs/vfs/t_vnops.c:1.49 --- src/tests/fs/vfs/t_vnops.c:1.48 Thu Apr 9 05:32:53 2015 +++ src/tests/fs/vfs/t_vnops.c Thu Apr 9 19:47:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.48 2015/04/09 05:32:53 riastradh Exp $ */ +/* $NetBSD: t_vnops.c,v 1.49 2015/04/09 19:47:05 riastradh Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -678,9 +678,6 @@ fcntl_lock(const atf_tc_t *tc, const cha RL(fd = rump_sys_open(TESTFILE, O_RDWR | O_CREAT, 0755)); RL(rump_sys_ftruncate(fd, 8192)); - /* PR kern/43321 */ - if (FSTYPE_ZFS(tc)) - atf_tc_expect_fail("PR kern/47656: Test known to be broken"); RL(rump_sys_fcntl(fd, F_SETLK, &l)); /* Next, we fork and try to lock the same area */ @@ -814,9 +811,6 @@ fcntl_getlock_pids(const atf_tc_t *tc, c RL(rump_sys_ftruncate(fd[i], sz)); - if (FSTYPE_ZFS(tc)) - atf_tc_expect_fail("PR kern/47656: Test known to be " - "broken"); if (i < __arraycount(lock)) { RL(rump_sys_fcntl(fd[i], F_SETLK, &lock[i])); expect[i].l_pid = pid[i];