diff options
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 68 |
1 files changed, 5 insertions, 63 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index cad3da36fb22..559fb8d51084 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -68,74 +68,16 @@ xfs_unmount_flush( | |||
68 | rid of. */ | 68 | rid of. */ |
69 | int relocation) /* Called from vfs relocation. */ | 69 | int relocation) /* Called from vfs relocation. */ |
70 | { | 70 | { |
71 | xfs_inode_t *rip = mp->m_rootip; | ||
72 | xfs_inode_t *rbmip; | ||
73 | xfs_inode_t *rsumip = NULL; | ||
74 | int error; | ||
75 | |||
76 | xfs_ilock(rip, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); | ||
77 | xfs_iflock(rip); | ||
78 | |||
79 | /* | ||
80 | * Flush out the real time inodes. | ||
81 | */ | ||
82 | if ((rbmip = mp->m_rbmip) != NULL) { | ||
83 | xfs_ilock(rbmip, XFS_ILOCK_EXCL); | ||
84 | xfs_iflock(rbmip); | ||
85 | error = xfs_iflush(rbmip, XFS_IFLUSH_SYNC); | ||
86 | xfs_iunlock(rbmip, XFS_ILOCK_EXCL); | ||
87 | |||
88 | if (error == EFSCORRUPTED) | ||
89 | goto fscorrupt_out; | ||
90 | |||
91 | ASSERT(vn_count(VFS_I(rbmip)) == 1); | ||
92 | |||
93 | rsumip = mp->m_rsumip; | ||
94 | xfs_ilock(rsumip, XFS_ILOCK_EXCL); | ||
95 | xfs_iflock(rsumip); | ||
96 | error = xfs_iflush(rsumip, XFS_IFLUSH_SYNC); | ||
97 | xfs_iunlock(rsumip, XFS_ILOCK_EXCL); | ||
98 | |||
99 | if (error == EFSCORRUPTED) | ||
100 | goto fscorrupt_out; | ||
101 | |||
102 | ASSERT(vn_count(VFS_I(rsumip)) == 1); | ||
103 | } | ||
104 | |||
105 | /* | ||
106 | * Synchronously flush root inode to disk | ||
107 | */ | ||
108 | error = xfs_iflush(rip, XFS_IFLUSH_SYNC); | ||
109 | if (error == EFSCORRUPTED) | ||
110 | goto fscorrupt_out2; | ||
111 | |||
112 | if (vn_count(VFS_I(rip)) != 1 && !relocation) { | ||
113 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | ||
114 | return XFS_ERROR(EBUSY); | ||
115 | } | ||
116 | |||
117 | /* | 71 | /* |
118 | * Release dquot that rootinode, rbmino and rsumino might be holding, | 72 | * Release dquot that rootinode, rbmino and rsumino might be holding, |
119 | * flush and purge the quota inodes. | 73 | * flush and purge the quota inodes. |
120 | */ | 74 | */ |
121 | error = XFS_QM_UNMOUNT(mp); | 75 | XFS_QM_UNMOUNT(mp); |
122 | if (error == EFSCORRUPTED) | ||
123 | goto fscorrupt_out2; | ||
124 | 76 | ||
125 | if (rbmip) { | 77 | if (mp->m_rbmip) |
126 | IRELE(rbmip); | 78 | IRELE(mp->m_rbmip); |
127 | IRELE(rsumip); | 79 | if (mp->m_rsumip) |
128 | } | 80 | IRELE(mp->m_rsumip); |
129 | 81 | ||
130 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | ||
131 | return 0; | 82 | return 0; |
132 | |||
133 | fscorrupt_out: | ||
134 | xfs_ifunlock(rip); | ||
135 | |||
136 | fscorrupt_out2: | ||
137 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | ||
138 | |||
139 | return XFS_ERROR(EFSCORRUPTED); | ||
140 | } | 83 | } |
141 | |||