From: Matthew Dillon Date: Tue, 5 Jul 2005 00:14:27 +0000 (+0000) Subject: The size of a nesting record may not be known (due to the virtual stream X-Git-Tag: v2.0.1~6701 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/b7ef558f23808190b9c35ed1ea3c36b71e2b68b2 The size of a nesting record may not be known (due to the virtual stream being larger then the in-memory FIFO). Instead of setting the header size to 8, set it to -1 to make this case clear. --- diff --git a/sys/kern/vfs_jops.c b/sys/kern/vfs_jops.c index 1e2264c58b..eb99b938ab 100644 --- a/sys/kern/vfs_jops.c +++ b/sys/kern/vfs_jops.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_jops.c,v 1.14 2005/07/04 21:05:53 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_jops.c,v 1.15 2005/07/05 00:14:27 dillon Exp $ */ /* * Each mount point may have zero or more independantly configured journals @@ -1298,7 +1298,16 @@ jrecord_write(struct jrecord *jrec, int16_t rectype, int bytes) last = (void *)jrec->stream_ptr; last->rectype = rectype; last->reserved = 0; - last->recsize = sizeof(struct journal_subrecord) + bytes; + + /* + * We may not know the record size for recursive records and the + * header may become unavailable due to limited FIFO space. Write + * -1 to indicate this special case. + */ + if ((rectype & JMASK_NESTED) && bytes == 0) + last->recsize = -1; + else + last->recsize = sizeof(struct journal_subrecord) + bytes; jrec->last = last; jrec->residual = bytes; /* remaining data to be posted */ jrec->residual_align = -bytes & 7; /* post-data alignment required */ diff --git a/sys/kern/vfs_journal.c b/sys/kern/vfs_journal.c index 260125720e..85098d77af 100644 --- a/sys/kern/vfs_journal.c +++ b/sys/kern/vfs_journal.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_journal.c,v 1.14 2005/07/04 21:05:53 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_journal.c,v 1.15 2005/07/05 00:14:27 dillon Exp $ */ /* * Each mount point may have zero or more independantly configured journals @@ -1298,7 +1298,16 @@ jrecord_write(struct jrecord *jrec, int16_t rectype, int bytes) last = (void *)jrec->stream_ptr; last->rectype = rectype; last->reserved = 0; - last->recsize = sizeof(struct journal_subrecord) + bytes; + + /* + * We may not know the record size for recursive records and the + * header may become unavailable due to limited FIFO space. Write + * -1 to indicate this special case. + */ + if ((rectype & JMASK_NESTED) && bytes == 0) + last->recsize = -1; + else + last->recsize = sizeof(struct journal_subrecord) + bytes; jrec->last = last; jrec->residual = bytes; /* remaining data to be posted */ jrec->residual_align = -bytes & 7; /* post-data alignment required */