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


Groups > linux.kernel > #1240116

Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings

Path csiph.com!goblin2!goblin.stu.neva.ru!ecngs!testfeeder.ecngs.de!46.4.82.166.MISMATCH!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod
From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings
Date Tue, 06 Oct 2015 04:00:02 +0200
Message-ID <qgpHQ-5h-7@gated-at.bofh.it> (permalink)
References <qedKO-5VS-13@gated-at.bofh.it> <qedKO-5VS-11@gated-at.bofh.it> <qez8C-34Q-3@gated-at.bofh.it>
X-Original-To Dave Chinner <david@fromorbit.com>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=HqRaLOBfFQ7QKZGV+Rnf0Dg4U6FV9aAr9BlNvPfNwxA=; b=eUq/VZRC8qqYCoOqdK3fJVByQmOD9IIXx3O28h9K+Yse0AvT9RKxQWIQKCuDbDQ++0 hbamQYdo7Fd319WEa5yjYTsHuA0wyqkg7BFdWSm3euyKmJku9no6EC4PhlBQzAwz1rgq yG42ByrR9eRiY7q5TBOqoBdmbX/UleCn+Al7nVZ47muPqRcBqCQftqTJrlFM2vDWj1c+ XyDtxL/sjdyCpu9cGJDKAKtehhvaj48iPnAZgdhjQcndy1/COFxXqdcWmos5/2gYC+ib HN58l6rzhkACI3eq4TXyyWguFvTSgH0dv0I7pUBYks0kRvy+SjlYhwaO2sn7MPxIazol 4R/w==
X-Gm-Message-State ALoCoQlN8uaNOf2IPhBGC/OavYmeX7Lx2wrQIpF3La3bNnPmIOJbDiRV3zINqxoNQpVgRequYYOF
MIME-Version 1.0
X-Received by 10.180.184.134 with SMTP id eu6mr15502103wic.77.1444096640134; Mon, 05 Oct 2015 18:57:20 -0700 (PDT)
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 67
Organization linux.* mail to news gateway
X-Original-Cc Jens Axboe <axboe@kernel.dk>, Boaz Harrosh <boaz@plexistor.com>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Ross Zwisler <ross.zwisler@linux.intel.com>, Christoph Hellwig <hch@lst.de>
X-Original-Date Mon, 5 Oct 2015 18:57:19 -0700
X-Original-Message-ID <CAPcyv4gw=sGqH=bTP7zkMgQCeJefrCbXNW9CHfqHCqd=DcKbPQ@mail.gmail.com>
X-Original-References <20150930002927.37133.331.stgit@dwillia2-desk3.jf.intel.com> <20150930004136.37133.66059.stgit@dwillia2-desk3.jf.intel.com> <20150930233529.GE3902@dastard>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1240116

Show key headers only | View raw


On Wed, Sep 30, 2015 at 4:35 PM, Dave Chinner <david@fromorbit.com> wrote:
> On Tue, Sep 29, 2015 at 08:41:36PM -0400, Dan Williams wrote:
>> The DAX implementation needs to protect new calls to ->direct_access()
>> and usage of its return value against unbind of the underlying block
>> device.  Use blk_queue_enter()/blk_queue_exit() to either prevent
>> blk_cleanup_queue() from proceeding, or fail the dax_map_bh() if the
>> request_queue is being torn down.
>>
>> Cc: Jens Axboe <axboe@kernel.dk>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Cc: Boaz Harrosh <boaz@plexistor.com>
>> Cc: Dave Chinner <david@fromorbit.com>
>> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  block/blk.h            |    2 -
>>  fs/dax.c               |  130 +++++++++++++++++++++++++++++++-----------------
>>  include/linux/blkdev.h |    2 +
>>  3 files changed, 85 insertions(+), 49 deletions(-)
>>
>> diff --git a/block/blk.h b/block/blk.h
>> index 5b2cd393afbe..0f8de0dda768 100644
>> --- a/block/blk.h
>> +++ b/block/blk.h
>> @@ -72,8 +72,6 @@ void blk_dequeue_request(struct request *rq);
>>  void __blk_queue_free_tags(struct request_queue *q);
>>  bool __blk_end_bidi_request(struct request *rq, int error,
>>                           unsigned int nr_bytes, unsigned int bidi_bytes);
>> -int blk_queue_enter(struct request_queue *q, gfp_t gfp);
>> -void blk_queue_exit(struct request_queue *q);
>>  void blk_freeze_queue(struct request_queue *q);
>>
>>  static inline void blk_queue_enter_live(struct request_queue *q)
>> diff --git a/fs/dax.c b/fs/dax.c
>> index bcfb14bfc1e4..7ce002bb60d0 100644
>> --- a/fs/dax.c
>> +++ b/fs/dax.c
>> @@ -63,12 +63,42 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long size)
>>  }
>>  EXPORT_SYMBOL_GPL(dax_clear_blocks);
>>
>> -static long dax_get_addr(struct buffer_head *bh, void __pmem **addr,
>> -             unsigned blkbits)
>> +static void __pmem *__dax_map_bh(const struct buffer_head *bh, unsigned blkbits,
>> +             unsigned long *pfn, long *len)
>
> Please don't use bufferheads for this. Please pass an inode, the
> block and length to map, similar to dax_clear_blocks().
>
> Why? Because dax_clear_blocks() needs to do this "mapping" too,
> and it is called from contexts where there are no bufferheads.
> There's a good chance we'll need more mapping contexts like this in
> future, so lets not propagate bufferheads deeper into this code
> than we absilutely need to.
>
> We should be trying to limit/remove bufferheads in the DAX code, not
> propagating them deeper into the code...

So I gave this a try but ran into the road block that get_block() is
performing the inode to bdev conversion and that is filesystem
specific.  However, I'll at least not pass the bh into this map
routine and will call it dax_map_atomic() which is more accurate.
--
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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] block drivers + dax vs driver unbind Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
  [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
    Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dave Chinner <david@fromorbit.com> - 2015-10-01 01:40 +0200
      Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-10-01 02:20 +0200
      Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-10-06 04:00 +0200
        Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dave Chinner <david@fromorbit.com> - 2015-10-06 23:20 +0200
  [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
    Re: [PATCH 1/2] block: generic request_queue reference counting Christoph Hellwig <hch@lst.de> - 2015-10-04 08:50 +0200
      Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 01:50 +0200
    Re: [PATCH 1/2] block: generic request_queue reference counting Ming Lei <tom.leiming@gmail.com> - 2015-10-04 10:00 +0200
      Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 01:30 +0200
        Re: [PATCH 1/2] block: generic request_queue reference counting Ming Lei <tom.leiming@gmail.com> - 2015-10-06 12:50 +0200
          Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 18:10 +0200

csiph-web