Bug 182214 - vop_stdfsync() incorrectly retries too many times
Summary: vop_stdfsync() incorrectly retries too many times
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-18 21:40 UTC by dennis chang
Modified: 2017-12-31 22:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dennis chang 2013-09-18 21:40:00 UTC
  687         /*
  688          * If synchronous the caller expects us to completely resolve all
  689          * dirty buffers in the system.  Wait for in-progress I/O to
  690          * complete (which could include background bitmap writes), then
  691          * retry if dirty blocks still exist.
  692          */
  693         if (ap->a_waitfor == MNT_WAIT) {
  694                 bufobj_wwait(bo, 0, 0);
  695                 if (bo->bo_dirty.bv_cnt > 0) {
  696                         /*
  697                          * If we are unable to write any of these buffers
  698                          * then we fail now rather than trying endlessly
  699                          * to write them out.
  700                          */
  701                         TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs)
  702                                 if ((error = bp->b_error) == 0)  ---> error is constantly overwritten. It should bail out when any buffer has an error.
  703                                         continue;
  704                         if (error == 0 && --maxretry >= 0)  ----> error is from the last buffer, instead of any buffer.
  705                                 goto loop1;
  706                         error = EAGAIN;
  707                 }
  708         }

Fix: 

687         /*
  688          * If synchronous the caller expects us to completely resolve all
  689          * dirty buffers in the system.  Wait for in-progress I/O to
  690          * complete (which could include background bitmap writes), then
  691          * retry if dirty blocks still exist.
  692          */
  693         if (ap->a_waitfor == MNT_WAIT) {
  694                 bufobj_wwait(bo, 0, 0);
  695                 if (bo->bo_dirty.bv_cnt > 0) {
  696                         /*
  697                          * If we are unable to write any of these buffers
  698                          * then we fail now rather than trying endlessly
  699                          * to write them out.
  700                          */
  701                         TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) {
  702                                 if (bp->b_error)
  703                                         error = b_error;
                                              break;
                                      }
                              }
  704                         if (error == 0 && --maxretry >= 0)
  705                                 goto loop1;
  706                         error = EAGAIN;
  707                 }
  708         }
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:28 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped