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 Even though zfs_n...



details:   https://anonhg.NetBSD.org/src/rev/33309949b0b6
branches:  trunk
changeset: 447248:33309949b0b6
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Jan 05 09:20:29 2019 +0000

description:
Even though zfs_netbsd_putpages() cannot use ZFS_ENTER() it has
to respect the teardown lock.

Enter z_teardown_lock as reader and ZFS_EXIT().

Instead of ZFS_VERIFY_ZP() return without writing and without
error from zfs_putapage() if "z_sa_hdl == NULL".

diffstat:

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

diffs (44 lines):

diff -r b81c5fd269ef -r 33309949b0b6 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Sat Jan 05 09:16:46 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Sat Jan 05 09:20:29 2019 +0000
@@ -5863,6 +5863,11 @@
        struct uvm_object *uobj = &vp->v_uobj;
        kmutex_t *mtx = uobj->vmobjlock;
 
+       if (zp->z_sa_hdl == NULL) {
+               err = 0;
+               goto out_unbusy;
+       }
+
        off = pp[0]->offset;
        len = count * PAGESIZE;
        KASSERT(off + len <= round_page(zp->z_size));
@@ -5914,6 +5919,7 @@
        }
        dmu_tx_commit(tx);
 
+out_unbusy:
        mutex_enter(mtx);
        mutex_enter(&uvm_pageqlock);
        uvm_page_unbusy(pp, count);
@@ -5994,6 +6000,12 @@
                                return 0;
                        }
                }
+               /*
+                * Cannot use ZFS_ENTER() here as it returns with error
+                * if z_unmounted.  The next statement is equivalent.
+                */
+               rrm_enter(&zfsvfs->z_teardown_lock, RW_READER, FTAG);
+
                rl = zfs_range_lock(zp, offlo, len, RL_WRITER);
                mutex_enter(vp->v_interlock);
                tsd_set(zfs_putpage_key, &cleaned);
@@ -6011,6 +6023,7 @@
                if (cleaned)
                if (!async || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
                        zil_commit(zfsvfs->z_log, zp->z_id);
+               ZFS_EXIT(zfsvfs);
                fstrans_done(vp->v_mount);
        }
        return error;



Home | Main Index | Thread Index | Old Index