diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 51435dbce9c4..d3d38836f87f 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -22,11 +22,10 @@ | |||
22 | #include "xfs_log_format.h" | 22 | #include "xfs_log_format.h" |
23 | #include "xfs_trans_resv.h" | 23 | #include "xfs_trans_resv.h" |
24 | #include "xfs_bit.h" | 24 | #include "xfs_bit.h" |
25 | #include "xfs_inum.h" | ||
26 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
27 | #include "xfs_ag.h" | ||
28 | #include "xfs_mount.h" | 26 | #include "xfs_mount.h" |
29 | #include "xfs_da_format.h" | 27 | #include "xfs_da_format.h" |
28 | #include "xfs_da_btree.h" | ||
30 | #include "xfs_inode.h" | 29 | #include "xfs_inode.h" |
31 | #include "xfs_dir2.h" | 30 | #include "xfs_dir2.h" |
32 | #include "xfs_ialloc.h" | 31 | #include "xfs_ialloc.h" |
@@ -41,7 +40,6 @@ | |||
41 | #include "xfs_fsops.h" | 40 | #include "xfs_fsops.h" |
42 | #include "xfs_trace.h" | 41 | #include "xfs_trace.h" |
43 | #include "xfs_icache.h" | 42 | #include "xfs_icache.h" |
44 | #include "xfs_dinode.h" | ||
45 | #include "xfs_sysfs.h" | 43 | #include "xfs_sysfs.h" |
46 | 44 | ||
47 | 45 | ||
@@ -1074,11 +1072,23 @@ xfs_unmountfs( | |||
1074 | xfs_sysfs_del(&mp->m_kobj); | 1072 | xfs_sysfs_del(&mp->m_kobj); |
1075 | } | 1073 | } |
1076 | 1074 | ||
1077 | int | 1075 | /* |
1078 | xfs_fs_writable(xfs_mount_t *mp) | 1076 | * Determine whether modifications can proceed. The caller specifies the minimum |
1077 | * freeze level for which modifications should not be allowed. This allows | ||
1078 | * certain operations to proceed while the freeze sequence is in progress, if | ||
1079 | * necessary. | ||
1080 | */ | ||
1081 | bool | ||
1082 | xfs_fs_writable( | ||
1083 | struct xfs_mount *mp, | ||
1084 | int level) | ||
1079 | { | 1085 | { |
1080 | return !(mp->m_super->s_writers.frozen || XFS_FORCED_SHUTDOWN(mp) || | 1086 | ASSERT(level > SB_UNFROZEN); |
1081 | (mp->m_flags & XFS_MOUNT_RDONLY)); | 1087 | if ((mp->m_super->s_writers.frozen >= level) || |
1088 | XFS_FORCED_SHUTDOWN(mp) || (mp->m_flags & XFS_MOUNT_RDONLY)) | ||
1089 | return false; | ||
1090 | |||
1091 | return true; | ||
1082 | } | 1092 | } |
1083 | 1093 | ||
1084 | /* | 1094 | /* |
@@ -1086,9 +1096,9 @@ xfs_fs_writable(xfs_mount_t *mp) | |||
1086 | * | 1096 | * |
1087 | * Sync the superblock counters to disk. | 1097 | * Sync the superblock counters to disk. |
1088 | * | 1098 | * |
1089 | * Note this code can be called during the process of freezing, so | 1099 | * Note this code can be called during the process of freezing, so we use the |
1090 | * we may need to use the transaction allocator which does not | 1100 | * transaction allocator that does not block when the transaction subsystem is |
1091 | * block when the transaction subsystem is in its frozen state. | 1101 | * in its frozen state. |
1092 | */ | 1102 | */ |
1093 | int | 1103 | int |
1094 | xfs_log_sbcount(xfs_mount_t *mp) | 1104 | xfs_log_sbcount(xfs_mount_t *mp) |
@@ -1096,7 +1106,8 @@ xfs_log_sbcount(xfs_mount_t *mp) | |||
1096 | xfs_trans_t *tp; | 1106 | xfs_trans_t *tp; |
1097 | int error; | 1107 | int error; |
1098 | 1108 | ||
1099 | if (!xfs_fs_writable(mp)) | 1109 | /* allow this to proceed during the freeze sequence... */ |
1110 | if (!xfs_fs_writable(mp, SB_FREEZE_COMPLETE)) | ||
1100 | return 0; | 1111 | return 0; |
1101 | 1112 | ||
1102 | xfs_icsb_sync_counters(mp, 0); | 1113 | xfs_icsb_sync_counters(mp, 0); |