Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1232224

Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault()

From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault()
Date 2015-09-24 18:10 +0200
Message-ID <qchfQ-7YI-9@gated-at.bofh.it> (permalink)
References (1 earlier) <qbD8K-mn-17@gated-at.bofh.it> <qbDip-xc-3@gated-at.bofh.it> <qbFkf-3rQ-11@gated-at.bofh.it> <qbIBr-8lQ-7@gated-at.bofh.it> <qbOdP-84X-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Sep 23, 2015 at 2:04 AM, Dave Chinner <david@fromorbit.com> wrote:
> On Tue, Sep 22, 2015 at 08:00:29PM -0700, Dan Williams wrote:
>> The kaddr is coming from the devm_memremap() in the pmem driver that
>> gets unmapped after the device is released by the driver.
>
> Perhaps the better solution is to not tear down the block device
> until all active references have gone away? i.e. unbind puts the
> device into a persistent error state and forces all active mappings
> to refault. Hence all future accesses error out and then when the
> user unmounts the unhappy filesystem the last reference to the
> blockdev goes away and the mappings can be torn down safely...

In fact this is how it already works in the block layer, it's just
that the pmem driver was not participating in that mechanism.  The
filesystem prevents the gendisk and hosting driver module from going
away via the heavyweight get_disk().  The gendisk keeps the
request_queue from being de-allocated, but the queue can go "dead" to
new requests at any time.  Single-queue based drivers take the
queue_lock and check blk_queue_dying() before allowing new requests.
Multi-queue drivers take a lighter-weight approach and try to get a
new "live" reference from a percpu_refcount.

When the backing device is unplugged or otherwise unbound from its
driver it calls blk_cleanup_queue() in its shutdown path.  That marks
the queue dead and flushes any outstanding requests.  From that point
forward all requests end in error until the final put_disk().

This is what I came up with for pmem:
https://lists.01.org/pipermail/linux-nvdimm/2015-September/002206.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-09-22 21:40 +0200
  Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dan Williams <dan.j.williams@intel.com> - 2015-09-22 23:00 +0200
    Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dan Williams <dan.j.williams@intel.com> - 2015-09-22 23:30 +0200
  Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Andrew Morton <akpm@linux-foundation.org> - 2015-09-22 23:20 +0200
    Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dan Williams <dan.j.williams@intel.com> - 2015-09-22 23:30 +0200
      Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dave Chinner <david@fromorbit.com> - 2015-09-23 01:40 +0200
        Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dan Williams <dan.j.williams@intel.com> - 2015-09-23 05:10 +0200
          Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dave Chinner <david@fromorbit.com> - 2015-09-23 11:10 +0200
            Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Boaz Harrosh <boaz@plexistor.com> - 2015-09-24 11:00 +0200
            Re: [PATCH v2] dax: fix NULL pointer in __dax_pmd_fault() Dan Williams <dan.j.williams@intel.com> - 2015-09-24 18:10 +0200

csiph-web