[PATCH 5/8] xfsprogs: Drop root inode refrerence in libxfs_umount()

Alex Elder
2011-11-10T20:35:40Z

From: Kevan Rehm <kfr@sgi.com>

Routine libxfs_umount() did not call libxfs_iput for the m_rootip
inode, so updates made to that inode could be lost. This adds the
missing call, and re-initializes the m_rootip pointer to be null.

Since the root inode reference is now dropped by libxfs_umount(), it
should *not* be dropped in mkfs parseproto().

Signed-off-by: Alex Elder <aelder@sgi.com>
---
libxfs/init.c | 4 ++++
mkfs/proto.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libxfs/init.c b/libxfs/init.c
index ba44c9b..d34fd8c 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -816,6 +816,10 @@ libxfs_umount(xfs_mount_t *mp)
int agno;

libxfs_rtmount_destroy(mp);
+ if (mp->m_rootip) {
+ libxfs_iput(mp->m_rootip, 0);
+ mp->m_rootip = NULL;
+ }
libxfs_icache_purge();
libxfs_bcache_purge();

diff --git a/mkfs/proto.c b/mkfs/proto.c
index 3021028..3f76862 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -571,7 +571,8 @@ parseproto(
break;
parseproto(mp, ip, fsxp, pp, name);
}
- libxfs_iput(ip, 0);
+ if (!isroot)
+ libxfs_iput(ip, 0);
return;
}
libxfs_trans_log_inode(tp, ip, flags);
--
1.7.6.4