* [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
@ 2026-11-04 5:52 James Hilliard
2026-11-18 9:45 ` Miquel Raynal
0 siblings, 1 reply; 7+ messages in thread
From: James Hilliard @ 2026-11-04 5:52 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Thomas Gleixner, Artem B. Bityuckiy
Cc: linux-mtd, linux-kernel, James Hilliard
create_bbt() returns an error if reading a bad-block marker fails, but
check_create() ignores that result. It can assign version 1 to the
incomplete RAM table and write it to the primary and mirror locations.
Unscanned factory-bad blocks then appear good in the persisted tables.
Propagate the scan failure before changing table versions or writing
either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/mtd/nand/raw/nand_bbt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index b0e7592a2ab7..db9d6458af51 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -1005,8 +1005,11 @@ static int check_create(struct nand_chip *this, uint8_t *buf,
continue;
/* Create the table in memory by scanning the chip(s) */
- if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
- create_bbt(this, buf, bd, chipsel);
+ if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY)) {
+ res = create_bbt(this, buf, bd, chipsel);
+ if (res)
+ return res;
+ }
td->version[i] = 1;
if (md)
---
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
change-id: 20261103-submit-rawnand-bbt-scan-error-v1-1183d881e5b2
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-04 5:52 [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails James Hilliard
@ 2026-11-18 9:45 ` Miquel Raynal
2026-11-18 19:11 ` James Hilliard
0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-11-18 9:45 UTC (permalink / raw)
To: James Hilliard
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
> create_bbt() returns an error if reading a bad-block marker fails,
This sentence does not mean anything.
> but
> check_create() ignores that result. It can assign version 1 to the
That's also unclear.
> incomplete RAM table and write it to the primary and mirror locations.
> Unscanned factory-bad blocks then appear good in the persisted tables.
Here is a proposal which I believe makes more sense:
mtd: rawnand: abort BBT creation on scan failure
create_bbt() can fail on a non-ECC OOB read error, leaving the RAM BBT
partially populated. It is preferable to bail out early rather than bump
the table versions and write incomplete primary and mirror tables, which
would mark the unscanned factory-bad blocks as good.
> Propagate the scan failure before changing table versions or writing
> either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
>
> Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
I would prefer if you could write your own commit logs, giving us more
confidence on the work that has been asked. You can use an LLM to
improve/enhance it obviously.
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-18 9:45 ` Miquel Raynal
@ 2026-11-18 19:11 ` James Hilliard
2026-11-19 8:38 ` Miquel Raynal
0 siblings, 1 reply; 7+ messages in thread
From: James Hilliard @ 2026-11-18 19:11 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
On Wed, Nov 18, 2026 at 2:45 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > create_bbt() returns an error if reading a bad-block marker fails,
>
> This sentence does not mean anything.
>
> > but
> > check_create() ignores that result. It can assign version 1 to the
>
> That's also unclear.
It's just stating where an unchecked return exists along with the
potential consequences of continuing without checking the return.
At least that was how I read it.
Is this commit message phrasing/style weird or something?
>
> > incomplete RAM table and write it to the primary and mirror locations.
> > Unscanned factory-bad blocks then appear good in the persisted tables.
>
> Here is a proposal which I believe makes more sense:
>
> mtd: rawnand: abort BBT creation on scan failure
>
> create_bbt() can fail on a non-ECC OOB read error, leaving the RAM BBT
> partially populated. It is preferable to bail out early rather than bump
> the table versions and write incomplete primary and mirror tables, which
> would mark the unscanned factory-bad blocks as good.
Personally I try to avoid terminology like "preferable" when describing
code behavior that's clearly wrong, as "preferable" to me at least weakly
implies that the code issue being fixed could be more of a style issue
rather than a correctness issue.
To me both commit messages seem to be equally understandable.
>
> > Propagate the scan failure before changing table versions or writing
> > either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
> >
> > Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
>
> I would prefer if you could write your own commit logs, giving us more
> confidence on the work that has been asked. You can use an LLM to
> improve/enhance it obviously.
To be honest I've never been great at writing commit messages in
general and have gotten a lot more complaints about commit messages
missing important details prior to using LLM's. I can barely tell the
difference between your suggested commit message and the original,
both seem more or less equally understandable to me, although maybe
I'm missing something that should be obvious?
I did use your commit message suggestions to refine my commit
message style guidelines so hopefully that helps.
>
> Thanks,
> Miquèl
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-18 19:11 ` James Hilliard
@ 2026-11-19 8:38 ` Miquel Raynal
2026-11-19 9:35 ` James Hilliard
0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-11-19 8:38 UTC (permalink / raw)
To: James Hilliard
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
On 18/11/2026 at 12:11:19 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
> On Wed, Nov 18, 2026 at 2:45 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>
>> On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
>>
>> > create_bbt() returns an error if reading a bad-block marker fails,
>>
>> This sentence does not mean anything.
>>
>> > but
>> > check_create() ignores that result. It can assign version 1 to the
>>
>> That's also unclear.
>
> It's just stating where an unchecked return exists along with the
> potential consequences of continuing without checking the return.
> At least that was how I read it.
>
> Is this commit message phrasing/style weird or something?
See just below one example:
>> > incomplete RAM table and write it to the primary and mirror
>>locations.
"the primary and mirror locations" -> this is a detail, that's not what
matters.
>> > Unscanned factory-bad blocks then appear good in the persisted
>> > tables.
>>
>> Here is a proposal which I believe makes more sense:
>>
>> mtd: rawnand: abort BBT creation on scan failure
>>
>> create_bbt() can fail on a non-ECC OOB read error, leaving the RAM BBT
>> partially populated. It is preferable to bail out early rather than bump
>> the table versions and write incomplete primary and mirror tables, which
>> would mark the unscanned factory-bad blocks as good.
>
> Personally I try to avoid terminology like "preferable" when
> describing
Yes, fine.
> code behavior that's clearly wrong, as "preferable" to me at least weakly
> implies that the code issue being fixed could be more of a style issue
> rather than a correctness issue.
>
> To me both commit messages seem to be equally understandable.
>
>>
>> > Propagate the scan failure before changing table versions or writing
>> > either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
>> >
>> > Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
>> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
>>
>> I would prefer if you could write your own commit logs, giving us more
>> confidence on the work that has been asked. You can use an LLM to
>> improve/enhance it obviously.
>
> To be honest I've never been great at writing commit messages in
> general and have gotten a lot more complaints about commit messages
> missing important details prior to using LLM's. I can barely tell the
For me the code is getting better but the commit logs are unclear. Some
details which don't need (imo) to be written are there, and the big
picture is often missing or not clearly stated before the details.
Don't get me wrong, using an LLM to refine/reword/reorganize is fine,
but letting the LLM write it entirely is not working well.
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-19 8:38 ` Miquel Raynal
@ 2026-11-19 9:35 ` James Hilliard
2026-11-19 10:18 ` Miquel Raynal
0 siblings, 1 reply; 7+ messages in thread
From: James Hilliard @ 2026-11-19 9:35 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
On Thu, Nov 19, 2026 at 1:38 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> On 18/11/2026 at 12:11:19 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > On Wed, Nov 18, 2026 at 2:45 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >>
> >> On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
> >>
> >> > create_bbt() returns an error if reading a bad-block marker fails,
> >>
> >> This sentence does not mean anything.
> >>
> >> > but
> >> > check_create() ignores that result. It can assign version 1 to the
> >>
> >> That's also unclear.
> >
> > It's just stating where an unchecked return exists along with the
> > potential consequences of continuing without checking the return.
> > At least that was how I read it.
> >
> > Is this commit message phrasing/style weird or something?
>
> See just below one example:
>
> >> > incomplete RAM table and write it to the primary and mirror
> >>locations.
>
> "the primary and mirror locations" -> this is a detail, that's not what
> matters.
>
> >> > Unscanned factory-bad blocks then appear good in the persisted
> >> > tables.
> >>
> >> Here is a proposal which I believe makes more sense:
> >>
> >> mtd: rawnand: abort BBT creation on scan failure
> >>
> >> create_bbt() can fail on a non-ECC OOB read error, leaving the RAM BBT
> >> partially populated. It is preferable to bail out early rather than bump
> >> the table versions and write incomplete primary and mirror tables, which
> >> would mark the unscanned factory-bad blocks as good.
> >
> > Personally I try to avoid terminology like "preferable" when
> > describing
>
> Yes, fine.
>
> > code behavior that's clearly wrong, as "preferable" to me at least weakly
> > implies that the code issue being fixed could be more of a style issue
> > rather than a correctness issue.
> >
> > To me both commit messages seem to be equally understandable.
> >
> >>
> >> > Propagate the scan failure before changing table versions or writing
> >> > either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
> >> >
> >> > Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
> >> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> >>
> >> I would prefer if you could write your own commit logs, giving us more
> >> confidence on the work that has been asked. You can use an LLM to
> >> improve/enhance it obviously.
> >
> > To be honest I've never been great at writing commit messages in
> > general and have gotten a lot more complaints about commit messages
> > missing important details prior to using LLM's. I can barely tell the
>
> For me the code is getting better but the commit logs are unclear. Some
> details which don't need (imo) to be written are there, and the big
> picture is often missing or not clearly stated before the details.
>
> Don't get me wrong, using an LLM to refine/reword/reorganize is fine,
> but letting the LLM write it entirely is not working well.
I guess the issue is that I often don't have the best understanding
of what the big picture that needs explanation in the commit messages
is some of the time, if I did then I would then just instruct the LLM to
make those edits whenever I review patches before sending them.
I think I just don't have good intuition when it comes to predicting what is
important to explain in commit messages.
>
> Thanks,
> Miquèl
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-19 9:35 ` James Hilliard
@ 2026-11-19 10:18 ` Miquel Raynal
2026-11-19 10:40 ` James Hilliard
0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-11-19 10:18 UTC (permalink / raw)
To: James Hilliard
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
>> >> I would prefer if you could write your own commit logs, giving us more
>> >> confidence on the work that has been asked. You can use an LLM to
>> >> improve/enhance it obviously.
>> >
>> > To be honest I've never been great at writing commit messages in
>> > general and have gotten a lot more complaints about commit messages
>> > missing important details prior to using LLM's. I can barely tell the
>>
>> For me the code is getting better but the commit logs are unclear. Some
>> details which don't need (imo) to be written are there, and the big
>> picture is often missing or not clearly stated before the details.
>>
>> Don't get me wrong, using an LLM to refine/reword/reorganize is fine,
>> but letting the LLM write it entirely is not working well.
>
> I guess the issue is that I often don't have the best understanding
> of what the big picture that needs explanation in the commit messages
> is some of the time, if I did then I would then just instruct the LLM to
> make those edits whenever I review patches before sending them.
>
> I think I just don't have good intuition when it comes to predicting what is
> important to explain in commit messages.
I get it, but for someone submitting this many patches, that lack of
understanding is precisely the problem: delegating the wording to an LLM
when you don't know the rationale doesn't remove the cost, it just
shifts it onto others.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
2026-11-19 10:18 ` Miquel Raynal
@ 2026-11-19 10:40 ` James Hilliard
0 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-11-19 10:40 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Gleixner,
Artem B. Bityuckiy, linux-mtd, linux-kernel
On Thu, Nov 19, 2026 at 3:19 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
>
> >> >> I would prefer if you could write your own commit logs, giving us more
> >> >> confidence on the work that has been asked. You can use an LLM to
> >> >> improve/enhance it obviously.
> >> >
> >> > To be honest I've never been great at writing commit messages in
> >> > general and have gotten a lot more complaints about commit messages
> >> > missing important details prior to using LLM's. I can barely tell the
> >>
> >> For me the code is getting better but the commit logs are unclear. Some
> >> details which don't need (imo) to be written are there, and the big
> >> picture is often missing or not clearly stated before the details.
> >>
> >> Don't get me wrong, using an LLM to refine/reword/reorganize is fine,
> >> but letting the LLM write it entirely is not working well.
> >
> > I guess the issue is that I often don't have the best understanding
> > of what the big picture that needs explanation in the commit messages
> > is some of the time, if I did then I would then just instruct the LLM to
> > make those edits whenever I review patches before sending them.
> >
> > I think I just don't have good intuition when it comes to predicting what is
> > important to explain in commit messages.
>
> I get it, but for someone submitting this many patches, that lack of
> understanding is precisely the problem: delegating the wording to an LLM
> when you don't know the rationale doesn't remove the cost, it just
> shifts it onto others.
It's a bit tricky since it's not that I don't have any rationale, it's more
that I don't always have the best big picture rationale since that's a
bit more subjective.
The rationale I'm using is generally more related to a TLA+ test
and/or fault injection test that was used to confirm/discover the bug.
I guess the issue is probably that the pathway used to prove the
bug can be somewhat detached from the bigger picture.
I've tweaked my workflows to do more analysis to try and derive
the bigger picture rationale for better commit messages rather
than focusing as much on the most proximal failure pathway to
the bug. Hopefully from there it will be more obvious what the
commit message should focus on.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-19 10:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 5:52 [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails James Hilliard
2026-11-18 9:45 ` Miquel Raynal
2026-11-18 19:11 ` James Hilliard
2026-11-19 8:38 ` Miquel Raynal
2026-11-19 9:35 ` James Hilliard
2026-11-19 10:18 ` Miquel Raynal
2026-11-19 10:40 ` James Hilliard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®