Re: [PATCH 25/30] libxfs: fix root inode handling inconsistencies

Christoph Hellwig
2013-10-30T10:23:23Z

On Wed, Oct 30, 2013 at 03:31:16PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 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.

I think the right fix is to kill LIBXFS_MOUNT_ROOTINOS as nothing
ever uses mp->m_rootip.