diff options
author | David Chinner <dgc@sgi.com> | 2008-04-09 22:20:03 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 21:53:51 -0400 |
commit | 714082bc12b6c305f825411df02177efcb0085f1 (patch) | |
tree | 2fd7f10bc2f3aeca24457534cf716db6a47fdf26 | |
parent | 36fbe6e6bd5408b09341043dfece978b4a7a0f34 (diff) |
[XFS] Report errors from xfs_reserve_blocks().
xfs_reserve_blocks() can fail in interesting ways. In neither case is it a
fatal error, but the result can lead to sub-optimal behaviour. Warn to the
syslog if the call fails but otherwise continue.
SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30784a
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r-- | fs/xfs/xfs_mount.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index eb348c168505..244aa1b9f134 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1227,12 +1227,15 @@ xfs_mountfs( | |||
1227 | * | 1227 | * |
1228 | * We default to 5% or 1024 fsbs of space reserved, whichever is smaller. | 1228 | * We default to 5% or 1024 fsbs of space reserved, whichever is smaller. |
1229 | * This may drive us straight to ENOSPC on mount, but that implies | 1229 | * This may drive us straight to ENOSPC on mount, but that implies |
1230 | * we were already there on the last unmount. | 1230 | * we were already there on the last unmount. Warn if this occurs. |
1231 | */ | 1231 | */ |
1232 | resblks = mp->m_sb.sb_dblocks; | 1232 | resblks = mp->m_sb.sb_dblocks; |
1233 | do_div(resblks, 20); | 1233 | do_div(resblks, 20); |
1234 | resblks = min_t(__uint64_t, resblks, 1024); | 1234 | resblks = min_t(__uint64_t, resblks, 1024); |
1235 | xfs_reserve_blocks(mp, &resblks, NULL); | 1235 | error = xfs_reserve_blocks(mp, &resblks, NULL); |
1236 | if (error) | ||
1237 | cmn_err(CE_WARN, "XFS: Unable to allocate reserve blocks. " | ||
1238 | "Continuing without a reserve pool."); | ||
1236 | 1239 | ||
1237 | return 0; | 1240 | return 0; |
1238 | 1241 | ||
@@ -1268,6 +1271,7 @@ int | |||
1268 | xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) | 1271 | xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) |
1269 | { | 1272 | { |
1270 | __uint64_t resblks; | 1273 | __uint64_t resblks; |
1274 | int error = 0; | ||
1271 | 1275 | ||
1272 | /* | 1276 | /* |
1273 | * We can potentially deadlock here if we have an inode cluster | 1277 | * We can potentially deadlock here if we have an inode cluster |
@@ -1311,7 +1315,11 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) | |||
1311 | * value does not matter.... | 1315 | * value does not matter.... |
1312 | */ | 1316 | */ |
1313 | resblks = 0; | 1317 | resblks = 0; |
1314 | xfs_reserve_blocks(mp, &resblks, NULL); | 1318 | error = xfs_reserve_blocks(mp, &resblks, NULL); |
1319 | if (error) | ||
1320 | cmn_err(CE_WARN, "XFS: Unable to free reserved block pool. " | ||
1321 | "Freespace may not be correct on next mount."); | ||
1322 | |||
1315 | 1323 | ||
1316 | xfs_log_sbcount(mp, 1); | 1324 | xfs_log_sbcount(mp, 1); |
1317 | xfs_unmountfs_writesb(mp); | 1325 | xfs_unmountfs_writesb(mp); |