aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_fsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_fsops.c')
-rw-r--r--fs/xfs/xfs_fsops.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index e64ee5288b86..a6e54b3319bd 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -17,28 +17,29 @@
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_types.h" 20#include "xfs_shared.h"
21#include "xfs_log.h" 21#include "xfs_format.h"
22#include "xfs_trans.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h"
23#include "xfs_sb.h" 24#include "xfs_sb.h"
24#include "xfs_ag.h" 25#include "xfs_ag.h"
25#include "xfs_mount.h" 26#include "xfs_mount.h"
26#include "xfs_bmap_btree.h"
27#include "xfs_alloc_btree.h"
28#include "xfs_ialloc_btree.h"
29#include "xfs_dinode.h"
30#include "xfs_inode.h" 27#include "xfs_inode.h"
28#include "xfs_trans.h"
31#include "xfs_inode_item.h" 29#include "xfs_inode_item.h"
32#include "xfs_btree.h"
33#include "xfs_error.h" 30#include "xfs_error.h"
31#include "xfs_btree.h"
32#include "xfs_alloc_btree.h"
34#include "xfs_alloc.h" 33#include "xfs_alloc.h"
35#include "xfs_ialloc.h" 34#include "xfs_ialloc.h"
36#include "xfs_fsops.h" 35#include "xfs_fsops.h"
37#include "xfs_itable.h" 36#include "xfs_itable.h"
38#include "xfs_trans_space.h" 37#include "xfs_trans_space.h"
39#include "xfs_rtalloc.h" 38#include "xfs_rtalloc.h"
40#include "xfs_filestream.h"
41#include "xfs_trace.h" 39#include "xfs_trace.h"
40#include "xfs_log.h"
41#include "xfs_dinode.h"
42#include "xfs_filestream.h"
42 43
43/* 44/*
44 * File system operations 45 * File system operations
@@ -101,7 +102,9 @@ xfs_fs_geometry(
101 (xfs_sb_version_hasprojid32bit(&mp->m_sb) ? 102 (xfs_sb_version_hasprojid32bit(&mp->m_sb) ?
102 XFS_FSOP_GEOM_FLAGS_PROJID32 : 0) | 103 XFS_FSOP_GEOM_FLAGS_PROJID32 : 0) |
103 (xfs_sb_version_hascrc(&mp->m_sb) ? 104 (xfs_sb_version_hascrc(&mp->m_sb) ?
104 XFS_FSOP_GEOM_FLAGS_V5SB : 0); 105 XFS_FSOP_GEOM_FLAGS_V5SB : 0) |
106 (xfs_sb_version_hasftype(&mp->m_sb) ?
107 XFS_FSOP_GEOM_FLAGS_FTYPE : 0);
105 geo->logsectsize = xfs_sb_version_hassector(&mp->m_sb) ? 108 geo->logsectsize = xfs_sb_version_hassector(&mp->m_sb) ?
106 mp->m_sb.sb_logsectsize : BBSIZE; 109 mp->m_sb.sb_logsectsize : BBSIZE;
107 geo->rtsectsize = mp->m_sb.sb_blocksize; 110 geo->rtsectsize = mp->m_sb.sb_blocksize;
@@ -153,7 +156,7 @@ xfs_growfs_data_private(
153 xfs_buf_t *bp; 156 xfs_buf_t *bp;
154 int bucket; 157 int bucket;
155 int dpct; 158 int dpct;
156 int error; 159 int error, saved_error = 0;
157 xfs_agnumber_t nagcount; 160 xfs_agnumber_t nagcount;
158 xfs_agnumber_t nagimax = 0; 161 xfs_agnumber_t nagimax = 0;
159 xfs_rfsblock_t nb, nb_mod; 162 xfs_rfsblock_t nb, nb_mod;
@@ -496,29 +499,33 @@ xfs_growfs_data_private(
496 error = ENOMEM; 499 error = ENOMEM;
497 } 500 }
498 501
502 /*
503 * If we get an error reading or writing alternate superblocks,
504 * continue. xfs_repair chooses the "best" superblock based
505 * on most matches; if we break early, we'll leave more
506 * superblocks un-updated than updated, and xfs_repair may
507 * pick them over the properly-updated primary.
508 */
499 if (error) { 509 if (error) {
500 xfs_warn(mp, 510 xfs_warn(mp,
501 "error %d reading secondary superblock for ag %d", 511 "error %d reading secondary superblock for ag %d",
502 error, agno); 512 error, agno);
503 break; 513 saved_error = error;
514 continue;
504 } 515 }
505 xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, XFS_SB_ALL_BITS); 516 xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, XFS_SB_ALL_BITS);
506 517
507 /*
508 * If we get an error writing out the alternate superblocks,
509 * just issue a warning and continue. The real work is
510 * already done and committed.
511 */
512 error = xfs_bwrite(bp); 518 error = xfs_bwrite(bp);
513 xfs_buf_relse(bp); 519 xfs_buf_relse(bp);
514 if (error) { 520 if (error) {
515 xfs_warn(mp, 521 xfs_warn(mp,
516 "write error %d updating secondary superblock for ag %d", 522 "write error %d updating secondary superblock for ag %d",
517 error, agno); 523 error, agno);
518 break; /* no point in continuing */ 524 saved_error = error;
525 continue;
519 } 526 }
520 } 527 }
521 return error; 528 return saved_error ? saved_error : error;
522 529
523 error0: 530 error0:
524 xfs_trans_cancel(tp, XFS_TRANS_ABORT); 531 xfs_trans_cancel(tp, XFS_TRANS_ABORT);