Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737280
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Javier González <jg@lightnvm.io> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/6] lightnvm: pblk: protect line bitmap while submitting meta io |
| Date | Fri, 22 Sep 2017 10:50:01 +0200 |
| Message-ID | <usrON-3W2-1@gated-at.bofh.it> (permalink) |
| References | <us7Q8-kv-67@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=SxetDIh+xrq251vFu0xV4IT62TT7Js1HQnDLg4gYeQU=; b=rAjqrhsClJrLSs1ZB7LyWu39HN2U9ZDWLyPftjfjSyFUWAxaBa6nGu/XDws4ygeXTA mak1FcHMArWYRZAooYWciMkJAsD32ddHWajFSvQBaUqsXwgiyVg1UTz/7Lqwi56kOjBR uw0A6AfHMn88RpWW4WSYkTzkq5I6qaWAUPFEtaG7b0qomBxhMRbbUWy7Jptde4raBOpG +l+3i33HAI+ewfM/JsqqjodfX8RdThbk9pdznMS/frn1T4Uy6vY9+8rk9fewEDjyfKAm iglMckimhAlKvvvMT24xExbjl0KdlbrO/tecgOUGyJ2q/tQXlDnig5SRLDna/yv2oECy tC3A== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=SxetDIh+xrq251vFu0xV4IT62TT7Js1HQnDLg4gYeQU=; b=kfkIxp7o+WFRg8vt3VWhyO02pY8dvKmx9bQWrledolbwbRVpQJDHlEIo4d8zhDM254 NrMR/SQXQwhVUjdlP187heawLqSshnDd9e1llTjLTTXgxxWedCmcrh1bQXEiSZO+MMYG /54yIl5kzn+WE5C2Ue3VEh5qus27S82bAcBZGTksm2h9/SDphll8HWHeKBY5aJaPBVsT wzSkJ87lFwyMUsW0egOgSpWSifijnFG91EpQZGJ0VXnh9yON0mQG9VrXtU0cacF+q4DY 8RChcwrwtHqs65kw6gzEpXxVz4AUZXYEOu/TxLgbAw8vTrDk+8nmakr3Pa/+BVCVjUJu 7LiQ== |
| X-Gm-Message-State | AHPjjUiZWpKSU8HuAWSNa1KYLUl4D3WBwwB4PhxbjxSzhuAvH7L/o+VL FLi5haBcqJDz8fsomlRKiKzhhsdb1Og= |
| X-Google-SMTP-Source | AOwi7QAPoAMF9ID4N9G7hvWm7NOeZ4yM52N7iaYHlSWU2e/Jd0xgadt330pJQCGmTpXPZwdfiUra4w== |
| X-Received | by 10.80.212.150 with SMTP id s22mr4125810edi.286.1506070142953; Fri, 22 Sep 2017 01:49:02 -0700 (PDT) |
| Content-Type | multipart/signed; boundary="Apple-Mail=_AF91417F-8D71-4A49-A8E7-65EC084E0804"; protocol="application/pgp-signature"; micalg=pgp-sha512 |
| MIME-Version | 1.0 (Mac OS X Mail 10.3 \(3273\)) |
| X-Mailer | Apple Mail (2.3273) |
| 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 | 79 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Matias Bjørling <mb@lightnvm.io>, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Fri, 22 Sep 2017 10:49:01 +0200 |
| X-Original-Message-ID | <A1244F27-AE62-433A-AFC2-5F40E8B96B53@lightnvm.io> |
| X-Original-References | <20170921112620.GA28524@dhcp-216.srv.tuxera.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1737280 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
> On 21 Sep 2017, at 13.26, Rakesh Pandit <rakesh@tuxera.com> wrote: > > It seems pblk_dealloc_page would race against pblk_alloc_pages for > line bitmap for sector allocation. The chances are very low but might > as well protect the bitmap properly. It's not even in fast path. > > Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> > --- > drivers/lightnvm/pblk-core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c > index a230125..b92eabc 100644 > --- a/drivers/lightnvm/pblk-core.c > +++ b/drivers/lightnvm/pblk-core.c > @@ -502,12 +502,14 @@ void pblk_dealloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs) > u64 addr; > int i; > > + spin_lock(&line->lock); > addr = find_next_zero_bit(line->map_bitmap, > pblk->lm.sec_per_line, line->cur_sec); > line->cur_sec = addr - nr_secs; > > for (i = 0; i < nr_secs; i++, line->cur_sec--) > WARN_ON(!test_and_clear_bit(line->cur_sec, line->map_bitmap)); > + spin_lock(&line->lock); > } > > u64 __pblk_alloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs) > -- > 2.5.0 Looks good. The reason not to have locks here was that the caller is always on the write thread - who did the allocation -, since it is error handling. So there is no protection needed. In any case, it is better to have it since it is implemented as a helper function. Reviewed-by: Javier González <javier@cnexlabs.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/6] lightnvm: pblk: protect line bitmap while submitting meta io Rakesh Pandit <rakesh@tuxera.com> - 2017-09-21 13:30 +0200
Re: [PATCH 2/6] lightnvm: pblk: protect line bitmap while submitting meta io Javier González <jg@lightnvm.io> - 2017-09-22 10:50 +0200
Re: [PATCH 2/6] lightnvm: pblk: protect line bitmap while submitting meta io Matias Bjørling <mb@lightnvm.io> - 2017-09-25 12:20 +0200
csiph-web