rdonly: Fixed lfs3_m_isrdonly shortcut leaving traversals dangling
We were relying on the previous LFS3_TSTATE_OMDIRS logic implicitly
leaving t->ot NULL when it reaches the end of the linked-list. With the
lfs3_m_isrdonly shortcut we now need to do this explicitly.
Found by test_mount_flags
Adds a bit of code to both the default and rdonly builds, but a correct
filesystem is usually preferred over a small one:
code stack ctx
rdonly before: 10676 840 524
rdonly after: 10680 (+0.0%) 840 (+0.0%) 524 (+0.0%)
default before: 37320 2280 636
default after: 37324 (+0.0%) 2280 (+0.0%) 636 (+0.0%)
This commit is contained in:
@@ -9686,6 +9686,7 @@ static int lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_traversal_t *t,
|
|||||||
// note we can skip checking opened files if mounted rdonly,
|
// note we can skip checking opened files if mounted rdonly,
|
||||||
// this saves a bit of code when compiled rdonly
|
// this saves a bit of code when compiled rdonly
|
||||||
if (lfs3_m_isrdonly(lfs3->flags) || !t->ot) {
|
if (lfs3_m_isrdonly(lfs3->flags) || !t->ot) {
|
||||||
|
t->ot = NULL;
|
||||||
t->b.o.mdir.mid += 1;
|
t->b.o.mdir.mid += 1;
|
||||||
lfs3_t_settstate(&t->b.o.flags, LFS3_TSTATE_MDIR);
|
lfs3_t_settstate(&t->b.o.flags, LFS3_TSTATE_MDIR);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user