Message ID | 20241203174857.1259403-1-mtsai@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Mike Snitzer |
Headers | show |
Series | Fix dm_array_cursor skipping and error handling | expand |
Reviewed-by: thornber@redhat.com On Tue, Dec 3, 2024 at 5:49 PM Ming-Hung Tsai <mtsai@redhat.com> wrote: > > The cached block pointer in dm_array_cursor might be NULL if it reaches > an unreadable array block, or the array is empty. Therefore, > dm_array_cursor_end() should call dm_btree_cursor_end() unconditionally, > to prevent leaving unreleased btree blocks. > > Signed-off-by: Ming-Hung Tsai <mtsai@redhat.com> > Fixes: fdd1315aa5f0 ("dm array: introduce cursor api") > --- > drivers/md/persistent-data/dm-array.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c > index c46a374f7459..1c3af717ee4f 100644 > --- a/drivers/md/persistent-data/dm-array.c > +++ b/drivers/md/persistent-data/dm-array.c > @@ -961,10 +961,10 @@ EXPORT_SYMBOL_GPL(dm_array_cursor_begin); > > void dm_array_cursor_end(struct dm_array_cursor *c) > { > - if (c->block) { > + if (c->block) > unlock_ablock(c->info, c->block); > - dm_btree_cursor_end(&c->cursor); > - } > + > + dm_btree_cursor_end(&c->cursor); > } > EXPORT_SYMBOL_GPL(dm_array_cursor_end); > > -- > 2.47.0 >
diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index c46a374f7459..1c3af717ee4f 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -961,10 +961,10 @@ EXPORT_SYMBOL_GPL(dm_array_cursor_begin); void dm_array_cursor_end(struct dm_array_cursor *c) { - if (c->block) { + if (c->block) unlock_ablock(c->info, c->block); - dm_btree_cursor_end(&c->cursor); - } + + dm_btree_cursor_end(&c->cursor); } EXPORT_SYMBOL_GPL(dm_array_cursor_end);
The cached block pointer in dm_array_cursor might be NULL if it reaches an unreadable array block, or the array is empty. Therefore, dm_array_cursor_end() should call dm_btree_cursor_end() unconditionally, to prevent leaving unreleased btree blocks. Signed-off-by: Ming-Hung Tsai <mtsai@redhat.com> Fixes: fdd1315aa5f0 ("dm array: introduce cursor api") --- drivers/md/persistent-data/dm-array.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)