HomeFreeBSD

MFV r323917: 8648 Fix range locking in ZIL commit codepath

Description

MFV r323917: 8648 Fix range locking in ZIL commit codepath

illumos/illumos-gate@42b14111721da2ebd5159e7b45012a3eb0e3384c
https://github.com/illumos/illumos-gate/commit/42b14111721da2ebd5159e7b45012a3eb0e3384c

https://www.illumos.org/issues/8648

I'm opening this bug to track integration of the following ZFS on Linux
commit into illumos:

commit f763c3d1df569a8d6b60bcb5e95cf07aa7a189e6
Author: LOLi <loli10K@users.noreply.github.com>
Date:   Mon Aug 21 17:59:48 2017 +0200

    Fix range locking in ZIL commit codepath

    Since OpenZFS 7578 (1b7c1e5) if we have a ZVOL with logbias=throughput
    we will force WR_INDIRECT itxs in zvol_log_write() setting itx->itx_lr
    offset and length to the offset and length of the BIO from
    zvol_write()->zvol_log_write(): these offset and length are later used
    to take a range lock in zillog->zl_get_data function: zvol_get_data().

    Now suppose we have a ZVOL with blocksize=8K and push 4K writes to
    offset 0: we will only be range-locking 0-4096. This means the
    ASSERTion we make in dbuf_unoverride() is no longer valid because now
    dmu_sync() is called from zilog's get_data functions holding a partial
    lock on the dbuf.

    Fix this by taking a range lock on the whole block in zvol_get_data().

    Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: loli10K <ezomori.nozomu@gmail.com>

Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Alexander Motin <mav@FreeBSD.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: LOLi <loli10K@users.noreply.github.com>

MFC after: 10 days

Details

Provenance
avgAuthored on
Parents
rS323917: 8648 Fix range locking in ZIL commit codepath
Branches
Unknown
Tags
Unknown