Received: by 10.192.165.156 with SMTP id m28csp1135893imm; Wed, 18 Apr 2018 04:54:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+sCw3H7x1jJhY1jsQq209AezaahDIia7F0FY5ubITnEB7sgULKaPqVIqRq4y6baFeBzkp+ X-Received: by 2002:a17:902:a609:: with SMTP id u9-v6mr1843501plq.56.1524052479557; Wed, 18 Apr 2018 04:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524052479; cv=none; d=google.com; s=arc-20160816; b=M6APHLE7osGq1/lYhmQfkjLBM3+OL0jVYXprR2xrW5Fm9O6LXDVvT+qDyWeB4QV+vh YTCT6vN57F3hBQsp3FZCCKBw13G4sXGDKq4dzGSyrbe/vVrdTCdE+YHAs7XDXkNC4SG2 0WER/2AWFgeXriSrYuSmLU4rhzSK6EdQxGUCVLcIIRNEyOjJUet8hArhGiNxEpLfuK92 ujP8Zk67h2+7hYP0L+5C5u6NfYG/vL7UQRL+9kUpQdzrVAc1tDiepTdEldtq4zOvtQmq RXWoGDubd/PmTksrzmnXZNQRprmDcqna+yKqBoE6lWRxmlVMs+l3wTzThNJxHHYRNrkN FzMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature :arc-authentication-results; bh=Jl0SAQfPiuW6032vLPAxxAeZuiNhRPe9zwaYYHKe2Tg=; b=iwkfs6r4n2XzAI0vZDpWOnwnbS3yu9GIeg2TLr7thdQTWzbBw/D30CRSrGChB9OtNP E7D+B6gVAZwsJss89Y7mg2tkR2GaTa5y1yRB21hSwEV8iSGG84vNPW5/tuf50se+EFLq B8wNuhHob8bOuIfww3vWoq0nnZ6kX+qMIj0Ex0eLk9SITEek0hm9fjjt8PIDCQPHx9tk MCJPjkfSWaEyyO+PbzxP+LJaXVNIi0UkgcC1P4/p+duiDCuanbJszdbCT+vQBa2iPUrS ZDKij2kJzUv6cm2tCa+Ag3SOH8XZz2zSFIRISJGKLjWoqOkgnEaZssbdxvhSDPtrdRnM GG2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=NV159/KD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si1111966pll.449.2018.04.18.04.54.24; Wed, 18 Apr 2018 04:54:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=NV159/KD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753729AbeDRLxS (ORCPT + 99 others); Wed, 18 Apr 2018 07:53:18 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:44482 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421AbeDRLxR (ORCPT ); Wed, 18 Apr 2018 07:53:17 -0400 Received: by mail-io0-f196.google.com with SMTP id g9-v6so2036214iob.11 for ; Wed, 18 Apr 2018 04:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Jl0SAQfPiuW6032vLPAxxAeZuiNhRPe9zwaYYHKe2Tg=; b=NV159/KD/JcfxKWHTYqMx8Ysox5ydB+48jRD4/Tq0MDVIuWYoXzgej5DiP5IcgOMu5 7nIrwDEZpIpFOPWQWMbVKFFjTooSPs3XGV3xccPkTN6uqCMgrd7vPz5qc56VXonjb5AL I9on97nYM/Ez9Mr/xvHDz7hvzlzA1NHaqGFH8G0GcXMs1z4NhXVxC8hnp9KZ9WZgJpOI 6qYKswzOPRalmSBhk6IqwG/1p6wX48tO3KCrXbOVyID+z2bALHoXvmpuBqEa9VtmO9FC usHtImvl6ND+H2lplu2OTOG0Gq8irc6RM9Mph0JaQvGY27nPd1Nak91Jg+FlCygaYAKc 5DsQ== 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=Jl0SAQfPiuW6032vLPAxxAeZuiNhRPe9zwaYYHKe2Tg=; b=KgHiTlx3JXYR5IqShrAIgHT0o7iMEGERETPIMGwfVo5UHXS6gKVlzgb/MT8ViBHGHC rpC7lC0RYw3hdIU5jETZL7srlzySA30BTTXU0ywkR8l6HCs+JBZvmHgN/J66aMALNUUy BM/2a342axYoJzsBJ2noJ0Mn4aD4O7hl/fCoqJdDMaDNiE7zXgTVS/2sFObyqrhBsflq zS1qwGXw2nSmYNoaJ35YzSAIh82uiDK/0v82huoEZ5J2N2kmHpAOgEbIIRCMOsRkxJYi /Llh9pX2Ip8B7f8v6gnH/vF+TE8mF+xv8VFMzn82IWIkhHMl6F3IZ8HUUZW9i5Jxee0s F/IA== X-Gm-Message-State: ALQs6tASEgnxRMNsM+P++7EHh1bfI5YLsdhxoTOAY8EtP6q5bmtEpsSb NPUFypVkDFCnmzZy8hR3mcyO5Q== X-Received: by 2002:a6b:190e:: with SMTP id 14-v6mr1522669ioz.127.1524052396409; Wed, 18 Apr 2018 04:53:16 -0700 (PDT) Received: from [172.31.1.2] (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id s128-v6sm729155itb.39.2018.04.18.04.53.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 04:53:15 -0700 (PDT) From: =?utf-8?Q?Javier_Gonz=C3=A1lez?= Message-Id: <5C311756-8AF8-47B1-98A0-C76F650F3BC2@javigon.com> Content-Type: multipart/signed; boundary="Apple-Mail=_0B178F72-CFFD-4312-B725-3168A27EFD5A"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH 03/11] lightnvm: pblk: check read lba on gc path Date: Wed, 18 Apr 2018 04:53:06 -0700 In-Reply-To: Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org To: =?utf-8?Q?Matias_Bj=C3=B8rling?= References: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> <1523874332-6272-4-git-send-email-javier@cnexlabs.com> X-Mailer: Apple Mail (2.3445.6.18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_0B178F72-CFFD-4312-B725-3168A27EFD5A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 17 Apr 2018, at 05.03, Matias Bj=C3=B8rling wrote: >=20 > On 4/16/18 12:25 PM, Javier Gonz=C3=A1lez wrote: >> Check that the lba stored in the LBA metadata is correct in the GC = path >> too. This requires a new helper function to check random reads in the >> vector read. >> Signed-off-by: Javier Gonz=C3=A1lez >> --- >> drivers/lightnvm/pblk-read.c | 39 = +++++++++++++++++++++++++++++++++------ >> 1 file changed, 33 insertions(+), 6 deletions(-) >> diff --git a/drivers/lightnvm/pblk-read.c = b/drivers/lightnvm/pblk-read.c >> index 9eee10f69df0..0d45d4ffc370 100644 >> --- a/drivers/lightnvm/pblk-read.c >> +++ b/drivers/lightnvm/pblk-read.c >> @@ -113,15 +113,14 @@ static int pblk_submit_read_io(struct pblk = *pblk, struct nvm_rq *rqd) >> return NVM_IO_OK; >> } >> -static void pblk_read_check(struct pblk *pblk, struct nvm_rq *rqd, >> - sector_t blba) >> +static void pblk_read_check_seq(struct pblk *pblk, void *meta_list, >> + sector_t blba, int nr_lbas) >> { >> - struct pblk_sec_meta *meta_list =3D rqd->meta_list; >> - int nr_lbas =3D rqd->nr_ppas; >> + struct pblk_sec_meta *meta_lba_list =3D meta_list; >> int i; >> for (i =3D 0; i < nr_lbas; i++) { >> - u64 lba =3D le64_to_cpu(meta_list[i].lba); >> + u64 lba =3D le64_to_cpu(meta_lba_list[i].lba); >> if (lba =3D=3D ADDR_EMPTY) >> continue; >> @@ -130,6 +129,32 @@ static void pblk_read_check(struct pblk *pblk, = struct nvm_rq *rqd, >> } >> } >> +/* >> + * There can be wholes in the lba list. >> + */ >=20 > holes Can you change it? >=20 >> +static void pblk_read_check_rand(struct pblk *pblk, void *meta_list, >> + u64 *lba_list, int nr_lbas) >> +{ >> + struct pblk_sec_meta *meta_lba_list =3D meta_list; >> + int i, j; >> + >> + for (i =3D 0, j =3D 0; i < nr_lbas; i++) { >> + u64 lba =3D lba_list[i]; >> + u64 meta_lba; >> + >> + if (lba =3D=3D ADDR_EMPTY) >> + continue; >> + >> + meta_lba =3D le64_to_cpu(meta_lba_list[j++].lba); >=20 > You can move the j++ into the for loop. Although, why not use just the = i iterator? Look above, we only increase on valid lbas. >=20 >> + >> + if (lba !=3D meta_lba) { >> + pr_err("pblk: corrupted read LBA (%llu/%llu)\n", >> + lba, = meta_lba); >> + WARN_ON(1); >=20 > I don't understand this, if a corrupted LBA is found here, how is it > communicated back to pblk and the LBA can be recovered from elsewhere. > If the data is wrong, this should have been communicated by the drive > on the completion path. The drive is defect if this happens. >=20 This happens if a read does not match the lba stored on the LBA. This is definitely an error and it has helped us in the past to find race conditions on pblk's read path, specially when forming partial I/Os. If the read failed from the drive (e.g., when enabling HECC), we still want information about where it failed for debugging purposes. Same we do on the normal read path. Javier --Apple-Mail=_0B178F72-CFFD-4312-B725-3168A27EFD5A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEU1dMZpvMIkj0jATvPEYBfS0leOAFAlrXMaIACgkQPEYBfS0l eODjeA/9Fox9qyYRikEBg8oV/nJLu5I2UkcIH44IHOQfICfnlcmfXhZZbVsG9WZZ w9URG2rv6V4roBVqAHKmkYFmflgqWqtzMbytbvn7J2KYBjNy7BtmYOfyCWfLTyxU EGNV7bQODzgJYrjzRuqCOHuMe5ZsAXjd7ofWKSo+njaP0Kt7xEHESSNNolDhtXoD MtupRECA86WgkAmMjvWb+AR7PmsFAQ3o++Ig27xJlsU2qrh7rf1sGaLDe7CVs6N/ IGV2uQuiFj5Kj0VElHDQ8lQ0W/wUfx+ZwBArkmHBvKPyjWrcdhW9Tfxjwv4Cd4ph eo0E9RQAbdiFmsO+XZpDnPuBKOCWYsfXGxEiNVpsze18dXYbntRGjqEinpDlGRt4 mVFx1pE9iWr33e8AJDBPPRS8Bx8Ub8H4K93TEkFPMOOUbdy682pchBHOHJ/Ifm5l mzW5Q5hzeFkijsoWKnjypDJK2KhhkuT3pMs3JJiUadD4S7jnDLk8HVOnocC8XsF2 dZNgjE6wTSAmRFIqTYw58kl76is+tO6ESaV3ADfVFP+Cq3HWdVBVXnPtOy3pq+vF Og9kqK+VJdRgyBcmluonnuD6jn2E8DEq/yZyiWJImDdTqIl38XuhcLiUBNh/oSoH NqTY1+1TaL26nEUjHIN6MtgdpiaVgeDQuiynJwwVTxS4RFE9BsM= =iksq -----END PGP SIGNATURE----- --Apple-Mail=_0B178F72-CFFD-4312-B725-3168A27EFD5A--