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 For ZFS on NetBSD...



details:   https://anonhg.NetBSD.org/src/rev/29e9ea51d3cb
branches:  trunk
changeset: 464402:29e9ea51d3cb
user:      brad <brad%NetBSD.org@localhost>
date:      Fri Oct 04 23:06:19 2019 +0000

description:
For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r dd8d239ce99f -r 29e9ea51d3cb external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Fri Oct 04 22:48:45 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Fri Oct 04 23:06:19 2019 +0000
@@ -5318,7 +5318,8 @@
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
        if (error == 0)
                VN_KNOTE(dvp, NOTE_WRITE);
-       VOP_UNLOCK(*vpp, 0);
+       if (*vpp != NULL)
+               VOP_UNLOCK(*vpp, 0);
 
        return (error);
 }
@@ -5358,7 +5359,8 @@
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
        if (error == 0)
                VN_KNOTE(dvp, NOTE_WRITE);
-       VOP_UNLOCK(*vpp, 0);
+       if (*vpp != NULL)
+               VOP_UNLOCK(*vpp, 0);
 
        return (error);
 }
@@ -5428,7 +5430,8 @@
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
        if (error == 0)
                VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
-       VOP_UNLOCK(*vpp, 0);
+       if (*vpp != NULL)
+               VOP_UNLOCK(*vpp, 0);
 
        return (error);
 }
@@ -5717,7 +5720,8 @@
                VN_KNOTE(ap->a_dvp, NOTE_WRITE);
        KASSERT((error == 0) == (*vpp != NULL));
        KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-       VOP_UNLOCK(*vpp, 0);
+       if (*vpp != NULL)
+               VOP_UNLOCK(*vpp, 0);
 
        return (error);
 }



Home | Main Index | Thread Index | Old Index