From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 700E67F96 for ; Sun, 29 Sep 2013 22:15:56 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay1.corp.sgi.com (Postfix) with ESMTP id 310D08F8039 for ; Sun, 29 Sep 2013 20:15:56 -0700 (PDT) Received: from ipmail06.adl6.internode.on.net (ipmail06.adl6.internode.on.net [150.101.137.145]) by cuda.sgi.com with ESMTP id UzFCgVgdlowhzCnM for ; Sun, 29 Sep 2013 20:15:54 -0700 (PDT) Received: from disappointment.disaster.area ([192.168.1.110] helo=disappointment) by dastard with esmtp (Exim 4.76) (envelope-from ) id 1VQTxa-0006PZ-C7 for xfs@oss.sgi.com; Mon, 30 Sep 2013 13:15:46 +1000 Received: from dave by disappointment with local (Exim 4.80) (envelope-from ) id 1VQTxa-0002HB-BH for xfs@oss.sgi.com; Mon, 30 Sep 2013 13:15:46 +1000 From: Dave Chinner Subject: [PATCH 27/32] libxfs: fix root inode handling inconsistencies Date: Mon, 30 Sep 2013 13:15:39 +1000 Message-Id: <1380510944-8571-28-git-send-email-david@fromorbit.com> In-Reply-To: <1380510944-8571-1-git-send-email-david@fromorbit.com> References: <1380510944-8571-1-git-send-email-david@fromorbit.com> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: xfs@oss.sgi.com From: Dave Chinner When "mounting" a filesystem via libxfs_mount(), callers can tell libxfs to read the root and realtime inodes into cache. However, when unmounting the filesystem, libxfs_unmount() used to unconditionally free root inodes if they were present. This leads to interesting issues like in mkfs, when it handles creation, reading and freeing of the root and rt inodes itself. It, however, passes in the flag to tell libxfs_mount() to read the root inode, and so when unmounting throws an error like: cache_node_put: node put on refcount 0 (node=0x684610) When a second libxfs_iput() call is made on the root inode. Clean this up and fix up all the callers that use magic numbers rather than symbolic values to tell libxfs tomount the root inodes. Signed-off-by: Dave Chinner --- copy/xfs_copy.c | 3 ++- mkfs/xfs_mkfs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index bb37279..b6695d7 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -684,7 +684,8 @@ main(int argc, char **argv) sb = &mbuf.m_sb; libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp)); - mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 1); + mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, + LIBXFS_MOUNT_ROOTINOS); if (mp == NULL) { do_log(_("%s: %s filesystem failed to initialize\n" "%s: Aborting.\n"), progname, source_name, progname); diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index eafbed3..60e4d88 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -2556,6 +2556,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), memset(XFS_BUF_PTR(buf), 0, sectorsize); libxfs_sb_to_disk((void *)XFS_BUF_PTR(buf), sbp, XFS_SB_ALL_BITS); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_purgebuf(buf); /* * If the data area is a file, then grow it out to its final size @@ -2590,7 +2591,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), (xfs_extlen_t)XFS_FSB_TO_BB(mp, logblocks), &sbp->sb_uuid, logversion, lsunit, XLOG_FMT); - mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 1); + mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 0); if (mp == NULL) { fprintf(stderr, _("%s: filesystem failed to initialize\n"), progname); -- 1.8.3.2 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs