Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Always set "cn_na...



details:   https://anonhg.NetBSD.org/src/rev/1c249bb12c85
branches:  trunk
changeset: 839481:1c249bb12c85
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Feb 22 09:01:32 2019 +0000

description:
Always set "cn_namelen" in addition to "cn_nameptr".

Fix vnode locking for REMOVE, RMDIR and RENAME.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c |  26 +++++++++++++---
 1 files changed, 21 insertions(+), 5 deletions(-)

diffs (88 lines):

diff -r 2f41da3e8b9b -r 1c249bb12c85 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Fri Feb 22 06:49:15 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Fri Feb 22 09:01:32 2019 +0000
@@ -501,6 +501,9 @@
                        name = (char *)start;
 
                cn.cn_nameptr = name;
+#ifdef __NetBSD__
+               cn.cn_namelen = strlen(name);
+#endif
                error = VOP_CREATE(ZTOV(dzp), &vp, &cn, &xva.xva_vattr /*,vflg*/);
                break;
        case TX_MKDIR_ATTR:
@@ -519,6 +522,9 @@
                        name = (char *)(lr + 1);
 
                cn.cn_nameptr = name;
+#ifdef __NetBSD__
+               cn.cn_namelen = strlen(name);
+#endif
                error = VOP_MKDIR(ZTOV(dzp), &vp, &cn, &xva.xva_vattr /*,vflg*/);
                break;
        case TX_MKXATTR:
@@ -528,6 +534,9 @@
                name = (char *)(lr + 1);
                link = name + strlen(name) + 1;
                cn.cn_nameptr = name;
+#ifdef __NetBSD__
+               cn.cn_namelen = strlen(name);
+#endif
                error = VOP_SYMLINK(ZTOV(dzp), &vp, &cn, &xva.xva_vattr, link /*,vflg*/);
                break;
        default:
@@ -585,7 +594,7 @@
                goto fail;
        }
 #ifdef __NetBSD__
-       VOP_UNLOCK(vp, 0);
+       vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 #endif
 
        switch ((int)lr->lr_common.lrc_txtype) {
@@ -596,11 +605,12 @@
                error = VOP_RMDIR(ZTOV(dzp), vp, &cn /*,vflg*/);
                break;
        default:
+#ifdef __NetBSD__
+               vput(vp);
+#endif
                error = SET_ERROR(ENOTSUP);
        }
-#ifdef __NetBSD__
-       vrele(vp);
-#else
+#ifndef __NetBSD__
        vput(vp);
 #endif
        VOP_UNLOCK(ZTOV(dzp), 0);
@@ -635,6 +645,9 @@
                vflg |= FIGNORECASE;
 
        cn.cn_nameptr = name;
+#ifdef __NetBSD__
+       cn.cn_namelen = strlen(name);
+#endif
        cn.cn_cred = kcred;
 #ifndef __NetBSD__
        cn.cn_thread = curthread;
@@ -698,7 +711,9 @@
        VOP_UNLOCK(ZTOV(sdzp), 0);
        if (error != 0)
                goto fail;
+#ifndef __NetBSD__
        VOP_UNLOCK(svp, 0);
+#endif
 
        tcn.cn_nameptr = tname;
        tcn.cn_namelen = strlen(tname);
@@ -718,7 +733,8 @@
                goto fail;
        }
 #ifdef __NetBSD__
-       vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
+       if (tvp != NULL)
+               vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
 #endif
 
        error = VOP_RENAME(ZTOV(sdzp), svp, &scn, ZTOV(tdzp), tvp, &tcn /*,vflg*/);



Home | Main Index | Thread Index | Old Index