]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
libxfs: fix root inode handling inconsistencies
authorDave Chinner <dchinner@redhat.com>
Wed, 13 Nov 2013 06:40:39 +0000 (06:40 +0000)
committerRich Johnston <rjohnston@sgi.com>
Wed, 13 Nov 2013 17:08:19 +0000 (11:08 -0600)
commit9aa5711629b47642bb5b688a6a1410d223456fc8
treea507c7ce0a2e30431e07d3e019feceee6b3d95d7
parent6aa3d87bc45348dc0948ae0cea57bf3033d64694
libxfs: fix root inode handling inconsistencies

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 inodes and so can result in unbalanced freeing of inodes when
cleaning up during the unmount proceedure.

As it turns out, nothing ever uses mp->m_rootip and so we don't need
to read it in or free it, or even have a pointer to it in the struct
xfs_mount. Similarly, the only user of the realtime inodes is mkfs,
and it initialises them itself. Hence we can kill the m_rootip and
the realtime inode mounting code.

This leaves one user of LIBXFS_MOUNT_ROOTINOS - xfs_db - and that is
only used to initialise the in-core superblock counter values from
the ag header for xfs_check. Move this code to the xfs_db init
functions so we can get rid of the mount parameter previously used
to trigger all these behavours (LIBXFS_MOUNT_ROOTINOS) completely.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
copy/xfs_copy.c
db/init.c
include/libxfs.h
libxfs/init.c
mkfs/proto.c
mkfs/xfs_mkfs.c
repair/phase6.c