diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-10-08 06:56:08 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-10-17 14:39:14 -0400 |
commit | c75921a72a7c4bb73a5e09a697a672722e5543f1 (patch) | |
tree | ed46f37241cdc860ffc691f6d71159333c434a83 /fs/xfs/xfs_super.c | |
parent | c7eea6f7adca4501d2c2db7f0f7c9dc88efac95e (diff) |
xfs: xfs_quiesce_attr() should quiesce the log like unmount
xfs_quiesce_attr() is supposed to leave the log empty with an
unmount record written. Right now it does not wait for the AIL to be
emptied before writing the unmount record, not does it wait for
metadata IO completion, either. Fix it to use the same method and
code as xfs_log_unmount().
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r-- | fs/xfs/xfs_super.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 3bafe66227fb..fdedf2cabae3 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -1153,15 +1153,11 @@ xfs_restore_resvblks(struct xfs_mount *mp) | |||
1153 | * | 1153 | * |
1154 | * This ensures that the metadata is written to their location on disk rather | 1154 | * This ensures that the metadata is written to their location on disk rather |
1155 | * than just existing in transactions in the log. This means after a quiesce | 1155 | * than just existing in transactions in the log. This means after a quiesce |
1156 | * there is no log replay required to write the inodes to disk (this is the main | 1156 | * there is no log replay required to write the inodes to disk - this is the |
1157 | * difference between a sync and a quiesce). | 1157 | * primary difference between a sync and a quiesce. |
1158 | * | 1158 | * |
1159 | * This shoul deffectively mimic the code in xfs_unmountfs() and | 1159 | * Note: xfs_log_quiesce() stops background log work - the callers must ensure |
1160 | * xfs_log_umount() but without tearing down any structures. | 1160 | * it is started again when appropriate. |
1161 | * XXX: bug fixes needed! | ||
1162 | * | ||
1163 | * Note: this stops background log work - the callers must ensure it is started | ||
1164 | * again when appropriate. | ||
1165 | */ | 1161 | */ |
1166 | void | 1162 | void |
1167 | xfs_quiesce_attr( | 1163 | xfs_quiesce_attr( |
@@ -1180,39 +1176,18 @@ xfs_quiesce_attr( | |||
1180 | xfs_reclaim_inodes(mp, 0); | 1176 | xfs_reclaim_inodes(mp, 0); |
1181 | xfs_reclaim_inodes(mp, SYNC_WAIT); | 1177 | xfs_reclaim_inodes(mp, SYNC_WAIT); |
1182 | 1178 | ||
1183 | /* flush all pending changes from the AIL */ | ||
1184 | xfs_ail_push_all_sync(mp->m_ail); | ||
1185 | |||
1186 | /* stop background log work */ | ||
1187 | cancel_delayed_work_sync(&mp->m_log->l_work); | ||
1188 | |||
1189 | /* | ||
1190 | * Just warn here till VFS can correctly support | ||
1191 | * read-only remount without racing. | ||
1192 | */ | ||
1193 | WARN_ON(atomic_read(&mp->m_active_trans) != 0); | ||
1194 | |||
1195 | /* Push the superblock and write an unmount record */ | 1179 | /* Push the superblock and write an unmount record */ |
1196 | error = xfs_log_sbcount(mp); | 1180 | error = xfs_log_sbcount(mp); |
1197 | if (error) | 1181 | if (error) |
1198 | xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. " | 1182 | xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. " |
1199 | "Frozen image may not be consistent."); | 1183 | "Frozen image may not be consistent."); |
1200 | xfs_log_unmount_write(mp); | ||
1201 | |||
1202 | /* | 1184 | /* |
1203 | * At this point we might have modified the superblock again and thus | 1185 | * Just warn here till VFS can correctly support |
1204 | * added an item to the AIL, thus flush it again. | 1186 | * read-only remount without racing. |
1205 | */ | 1187 | */ |
1206 | xfs_ail_push_all_sync(mp->m_ail); | 1188 | WARN_ON(atomic_read(&mp->m_active_trans) != 0); |
1207 | 1189 | ||
1208 | /* | 1190 | xfs_log_quiesce(mp); |
1209 | * The superblock buffer is uncached and xfsaild_push() will lock and | ||
1210 | * set the XBF_ASYNC flag on the buffer. We cannot do xfs_buf_iowait() | ||
1211 | * here but a lock on the superblock buffer will block until iodone() | ||
1212 | * has completed. | ||
1213 | */ | ||
1214 | xfs_buf_lock(mp->m_sb_bp); | ||
1215 | xfs_buf_unlock(mp->m_sb_bp); | ||
1216 | } | 1191 | } |
1217 | 1192 | ||
1218 | STATIC int | 1193 | STATIC int |