From owner-svn-src-head@FreeBSD.ORG Thu Mar 6 00:10:07 2014 Return-Path: Delivered-To: svn-src-head@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 DEAE1526; Thu, 6 Mar 2014 00:10:07 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC12EFED; Thu, 6 Mar 2014 00:10:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s260A7on078735; Thu, 6 Mar 2014 00:10:07 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s260A7Dq078734; Thu, 6 Mar 2014 00:10:07 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201403060010.s260A7Dq078734@svn.freebsd.org> From: Jeff Roberson Date: Thu, 6 Mar 2014 00:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262812 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2014 00:10:07 -0000 Author: jeff Date: Thu Mar 6 00:10:07 2014 New Revision: 262812 URL: http://svnweb.freebsd.org/changeset/base/262812 Log: - Gracefully handle truncation failures when trying to shrink directories. This could cause dirhash panics since the dirhash state would be successfully truncated while the directory was not. Reported by: pho Discussed with: mckusick Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Wed Mar 5 23:37:25 2014 (r262811) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Mar 6 00:10:07 2014 (r262812) @@ -1130,12 +1130,15 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir dp->i_endoff && dp->i_endoff < dp->i_size) { if (tvp != NULL) VOP_UNLOCK(tvp, 0); + error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, + IO_NORMAL | IO_SYNC, cr); + if (error != 0) + vprint("ufs_direnter: failted to truncate", dvp); #ifdef UFS_DIRHASH - if (dp->i_dirhash != NULL) + if (error == 0 && dp->i_dirhash != NULL) ufsdirhash_dirtrunc(dp, dp->i_endoff); #endif - (void) UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, - IO_NORMAL | IO_SYNC, cr); + error = 0; if (tvp != NULL) vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); }