Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Oct 2020 22:41:03 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366551 - head/sys/ufs/ffs
Message-ID:  <202010082241.098Mf3qB022274@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Oct  8 22:41:02 2020
New Revision: 366551
URL: https://svnweb.freebsd.org/changeset/base/366551

Log:
  Do not leak B_BARRIER.
  
  Normally when a buffer with B_BARRIER is written, the flag is cleared
  by g_vfs_strategy() when creating bio.  But in some cases FFS buffer
  might not reach g_vfs_strategy(), for instance when copy-on-write
  reports an error like ENOSPC.  In this case buffer is returned to
  dirty queue and might be written later by other means.  Among then
  bdwrite() reasonably asserts that B_BARRIER is not set.
  
  In fact, the only current use of B_BARRIER is for lazy inode block
  initialization, where write of the new inode block is fenced against
  cylinder group write to mark inode as used.  The situation could be
  seen that we break dependency by updating cg without written out
  inode.  Practically since CoW was not able to find space for a copy of
  inode block, for the same reason cg group block write should fail.
  
  Reported by:	pho
  Discussed with:	chs, imp, mckusick
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D26511

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Thu Oct  8 22:34:34 2020	(r366550)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Thu Oct  8 22:41:02 2020	(r366551)
@@ -2582,6 +2582,7 @@ ffs_geom_strategy(struct bufobj *bo, struct buf *bp)
 					    error != EOPNOTSUPP) {
 						bp->b_error = error;
 						bp->b_ioflags |= BIO_ERROR;
+						bp->b_flags &= ~B_BARRIER;
 						bufdone(bp);
 						return;
 					}
@@ -2594,6 +2595,7 @@ ffs_geom_strategy(struct bufobj *bo, struct buf *bp)
 				if (error != 0 && error != EOPNOTSUPP) {
 					bp->b_error = error;
 					bp->b_ioflags |= BIO_ERROR;
+					bp->b_flags &= ~B_BARRIER;
 					bufdone(bp);
 					return;
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010082241.098Mf3qB022274>