Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Advisory locking for zfs.



details:   https://anonhg.NetBSD.org/src/rev/6ad304153620
branches:  trunk
changeset: 807427:6ad304153620
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Apr 09 19:47:05 2015 +0000

description:
Advisory locking for zfs.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h |   4 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c     |  32 +++++++++++++-
 tests/fs/vfs/t_vnops.c                                     |   8 +---
 3 files changed, 36 insertions(+), 8 deletions(-)

diffs (93 lines):

diff -r 33f580935102 -r 6ad304153620 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h        Thu Apr 09 19:35:55 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h        Thu Apr 09 19:47:05 2015 +0000
@@ -222,6 +222,10 @@
         */
        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;
 
 
diff -r 33f580935102 -r 6ad304153620 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Thu Apr 09 19:35:55 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Thu Apr 09 19:47:05 2015 +0000
@@ -5674,6 +5674,36 @@
 #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 @@
        { &vop_putpages_desc,           zfs_netbsd_putpages },
        { &vop_mmap_desc,               zfs_netbsd_mmap },
        { &vop_islocked_desc,           zfs_netbsd_islocked },
+       { &vop_advlock_desc,            zfs_netbsd_advlock },
 #ifdef notyet
-       { &vop_advlock_desc,            zfs_netbsd_advlock },
        { &vop_fcntl_desc,              zfs_netbsd_fcntl },
        { &vop_bmap_desc,               zfs_netbsd_bmap },
        { &vop_strategy_desc,           zfs_netbsd_strategy },          
diff -r 33f580935102 -r 6ad304153620 tests/fs/vfs/t_vnops.c
--- a/tests/fs/vfs/t_vnops.c    Thu Apr 09 19:35:55 2015 +0000
+++ b/tests/fs/vfs/t_vnops.c    Thu Apr 09 19:47:05 2015 +0000
@@ -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 @@
        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 @@
 
                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];



Home | Main Index | Thread Index | Old Index