From owner-svn-src-all@FreeBSD.ORG Tue Jul 1 06:59:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68DCAD9A; Tue, 1 Jul 2014 06:59:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C9B92C1E; Tue, 1 Jul 2014 06:59:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s616xOmu096243; Tue, 1 Jul 2014 06:59:24 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s616xOfc096242; Tue, 1 Jul 2014 06:59:24 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201407010659.s616xOfc096242@svn.freebsd.org> From: Scott Long Date: Tue, 1 Jul 2014 06:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268077 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jul 2014 06:59:24 -0000 Author: scottl Date: Tue Jul 1 06:59:23 2014 New Revision: 268077 URL: http://svnweb.freebsd.org/changeset/base/268077 Log: Merge r265463: Due to reasons unknown at this time, the system can be forced to write a journal block even when there are no journal entries to be written. Until the root cause is found, handle this case by ensuring that a valid journal segment is always written. Second, the data buffer used for writing journal entries was never being scrubbed of old data. Fix this. Submitted by: Takehara Mikihito Obtained from: Netflix, Inc. Modified: stable/10/sys/ufs/ffs/ffs_softdep.c Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Tue Jul 1 06:50:35 2014 (r268076) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Tue Jul 1 06:59:23 2014 (r268077) @@ -1275,6 +1275,7 @@ static int stat_cleanup_blkrequests; /* static int stat_cleanup_inorequests; /* Number of inode cleanup requests */ static int stat_cleanup_retries; /* Number of cleanups that needed to flush */ static int stat_cleanup_failures; /* Number of cleanup requests that failed */ +static int stat_emptyjblocks; /* Number of potentially empty journal blocks */ SYSCTL_INT(_debug_softdep, OID_AUTO, max_softdeps, CTLFLAG_RW, &max_softdeps, 0, ""); @@ -1334,6 +1335,8 @@ SYSCTL_INT(_debug_softdep, OID_AUTO, cle &stat_cleanup_failures, 0, ""); SYSCTL_INT(_debug_softdep, OID_AUTO, flushcache, CTLFLAG_RW, &softdep_flushcache, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, emptyjblocks, CTLFLAG_RD, + &stat_emptyjblocks, 0, ""); SYSCTL_DECL(_vfs_ffs); @@ -3328,6 +3331,24 @@ softdep_process_journal(mp, needwk, flag */ data = bp->b_data; off = 0; + + /* + * Always put a header on the first block. + * XXX As with below, there might not be a chance to get + * into the loop. Ensure that something valid is written. + */ + jseg_write(ump, jseg, data); + off += JREC_SIZE; + data = bp->b_data + off; + + /* + * XXX Something is wrong here. There's no work to do, + * but we need to perform and I/O and allow it to complete + * anyways. + */ + if (LIST_EMPTY(&ump->softdep_journal_pending)) + stat_emptyjblocks++; + while ((wk = LIST_FIRST(&ump->softdep_journal_pending)) != NULL) { if (cnt == 0) @@ -3377,6 +3398,11 @@ softdep_process_journal(mp, needwk, flag data = bp->b_data + off; cnt--; } + + /* Clear any remaining space so we don't leak kernel data */ + if (size > off) + bzero(data, size - off); + /* * Write this one buffer and continue. */