#1478 closed defect (fixed)

Calling rtems_bdbuf_release() for a buffer obtained with rtems_bdbuf_get() is incorrect

Reported by: Oleg Owned by: Joel Sherrill
Priority: lowest Milestone: 4.10
Component: lib/block Version: 4.10
Severity: minor Keywords:
Cc: thomas.doerfler@…, chrisj@…, nbkolchin@…, sebastian.huber@… Blocked By:
Blocking:

Description

Implementation of bdbuf API does not allow to call mentioned functions in sequence:

  1. rtems_bdbuf_get()
  2. rtems_bdbuf_release()

Even though we do not have code that calls them in such sequence, there might be some use cases when your algorithm does step by step fill in of one block (from scratch), but during processing an error might happen. As the result we may have the complete block not consistent, and as the result we would drop all the local changes, BUT bdbuf will NOT allow this!

In order to sort this out a new state might be added: ACCESS_EMPTY.
Then there will be the following states for buffers owned by an application:

  • ACCESS - for a buffer that was in sync with a disk at the time of returning to an application.
  • ACCESS_MODIFIED - a buffer was not in sync with the disk but had latest data at the time of returning to an application (any further call to rtems_bdbuf_release() or rtems_bdbuf_release_modified() will lead to buffer flash).
  • ACCESS_EMPTY - a buffer did not have any valid data at the time of returning to an application.

And here we may adapt logic of rtems_bdbuf_release() and rtems_bdbuf_release_modified():

  • rtems_bdbuf_release() for buffers in ACCESS_EMPTY state, it addes them into ready list.
  • rtems_bdbuf_release_modified() treats a buffer in ACCESS_EMPTY state the same as ACCESS or ACCESS_MODIFIED.

What do you think?

Change History (3)

comment:1 Changed on Dec 18, 2009 at 3:01:38 PM by Sebastian Huber

Cc: chrisj@… sebastian.huber@… thomas.doerfler@… added

comment:2 Changed on Jan 19, 2010 at 8:30:34 AM by Sebastian Huber

Resolution: fixed
Status: newclosed

Implemented as an side effect of the error handling changes. See also https://www.rtems.org/bugzilla/show_bug.cgi?id=1433.

comment:3 Changed on Oct 10, 2017 at 6:49:19 AM by Sebastian Huber

Component: fslib/block
Note: See TracTickets for help on using tickets.