From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752337AbdGYO1d (ORCPT ); Tue, 25 Jul 2017 10:27:33 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35152 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751853AbdGYO1b (ORCPT ); Tue, 25 Jul 2017 10:27:31 -0400 Date: Tue, 25 Jul 2017 16:27:29 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Richard Weinberger Cc: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Artem Bityutskiy , "linux-mtd@lists.infradead.org" , LKML Subject: Re: [PATCH 5/5] ubi: Allow to use read-only UBI volume with not enough PEBs Message-ID: <20170725142729.GL30901@pali> References: <1496418222-23483-1-git-send-email-pali.rohar@gmail.com> <1496418222-23483-6-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 21 July 2017 22:12:51 Richard Weinberger wrote: > Pali, > > On Fri, Jun 2, 2017 at 5:43 PM, Pali Rohár wrote: > > In read-only mode is skipped auto-resize. For pre-build images ready for > > auto-resize there can be reserved more PEBs as whole size of pre-build > > image. In read-only we do not do any write operation therefore this would > > allow to use read-only UBI volume which is not auto-resized yet. > > > > Signed-off-by: Pali Rohár > > --- > > drivers/mtd/ubi/vtbl.c | 14 +++++++++----- > > 1 file changed, 9 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c > > index 263743e..1d708c5 100644 > > --- a/drivers/mtd/ubi/vtbl.c > > +++ b/drivers/mtd/ubi/vtbl.c > > @@ -240,8 +240,10 @@ static int vtbl_check(const struct ubi_device *ubi, > > if (reserved_pebs > ubi->good_peb_count) { > > ubi_err(ubi, "too large reserved_pebs %d, good PEBs %d", > > reserved_pebs, ubi->good_peb_count); > > - err = 9; > > - goto bad; > > + if (!ubi->ro_mode) { > > + err = 9; > > + goto bad; > > + } > > I fear this is not correct, it will disable a legit self-check of UBI volumes. > If the read-only volume is corrupted/truncated and you miss PEBs, this > check will no longer > trigger. > > Especially when dealing with nanddumps, truncation is a common problem. Any idea how to fix it? Or how to handle read-only images which are marked for auto-resize? -- Pali Rohár pali.rohar@gmail.com