xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: [PATCH 5/8] xfsprogs: Drop root inode refrerence in libxfs_umount()
From: Alex Elder <aelder@xxxxxxx>
Date: Thu, 10 Nov 2011 14:35:15 -0600
Cc: Kevan Rehm <kfr@xxxxxxx>, Alex Elder <aelder@xxxxxxx>
In-reply-to: <1320957318-16269-1-git-send-email-aelder@xxxxxxx>
In-reply-to: <3ed89446f6dc1231ec1de712f242522052952b7e.1320955675.git.aelder@xxxxxxx>
References: <1320957318-16269-1-git-send-email-aelder@xxxxxxx>
References: <3ed89446f6dc1231ec1de712f242522052952b7e.1320955675.git.aelder@xxxxxxx>
From: Kevan Rehm <kfr@xxxxxxx>

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@xxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>