@@ -96,7 +96,6 @@ EXPORT_SYMBOL(jbd2_journal_release_jbd_inode);
96
96
EXPORT_SYMBOL (jbd2_journal_begin_ordered_truncate );
97
97
EXPORT_SYMBOL (jbd2_inode_cache );
98
98
99
- static void __journal_abort_soft (journal_t * journal , int errno );
100
99
static int jbd2_journal_create_slab (size_t slab_size );
101
100
102
101
#ifdef CONFIG_JBD2_DEBUG
@@ -805,7 +804,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
805
804
"at offset %lu on %s\n" ,
806
805
__func__ , blocknr , journal -> j_devname );
807
806
err = - EIO ;
808
- __journal_abort_soft (journal , err );
807
+ jbd2_journal_abort (journal , err );
809
808
}
810
809
} else {
811
810
* retp = blocknr ; /* +journal->j_blk_offset */
@@ -2103,64 +2102,6 @@ int jbd2_journal_wipe(journal_t *journal, int write)
2103
2102
return err ;
2104
2103
}
2105
2104
2106
- /*
2107
- * Journal abort has very specific semantics, which we describe
2108
- * for journal abort.
2109
- *
2110
- * Two internal functions, which provide abort to the jbd layer
2111
- * itself are here.
2112
- */
2113
-
2114
- /*
2115
- * Quick version for internal journal use (doesn't lock the journal).
2116
- * Aborts hard --- we mark the abort as occurred, but do _nothing_ else,
2117
- * and don't attempt to make any other journal updates.
2118
- */
2119
- void __jbd2_journal_abort_hard (journal_t * journal )
2120
- {
2121
- transaction_t * transaction ;
2122
-
2123
- if (journal -> j_flags & JBD2_ABORT )
2124
- return ;
2125
-
2126
- printk (KERN_ERR "Aborting journal on device %s.\n" ,
2127
- journal -> j_devname );
2128
-
2129
- write_lock (& journal -> j_state_lock );
2130
- journal -> j_flags |= JBD2_ABORT ;
2131
- transaction = journal -> j_running_transaction ;
2132
- if (transaction )
2133
- __jbd2_log_start_commit (journal , transaction -> t_tid );
2134
- write_unlock (& journal -> j_state_lock );
2135
- }
2136
-
2137
- /* Soft abort: record the abort error status in the journal superblock,
2138
- * but don't do any other IO. */
2139
- static void __journal_abort_soft (journal_t * journal , int errno )
2140
- {
2141
- int old_errno ;
2142
-
2143
- write_lock (& journal -> j_state_lock );
2144
- old_errno = journal -> j_errno ;
2145
- if (!journal -> j_errno || errno == - ESHUTDOWN )
2146
- journal -> j_errno = errno ;
2147
-
2148
- if (journal -> j_flags & JBD2_ABORT ) {
2149
- write_unlock (& journal -> j_state_lock );
2150
- if (old_errno != - ESHUTDOWN && errno == - ESHUTDOWN )
2151
- jbd2_journal_update_sb_errno (journal );
2152
- return ;
2153
- }
2154
- write_unlock (& journal -> j_state_lock );
2155
-
2156
- __jbd2_journal_abort_hard (journal );
2157
-
2158
- jbd2_journal_update_sb_errno (journal );
2159
- write_lock (& journal -> j_state_lock );
2160
- journal -> j_flags |= JBD2_REC_ERR ;
2161
- write_unlock (& journal -> j_state_lock );
2162
- }
2163
-
2164
2105
/**
2165
2106
* void jbd2_journal_abort () - Shutdown the journal immediately.
2166
2107
* @journal: the journal to shutdown.
@@ -2204,7 +2145,47 @@ static void __journal_abort_soft (journal_t *journal, int errno)
2204
2145
2205
2146
void jbd2_journal_abort (journal_t * journal , int errno )
2206
2147
{
2207
- __journal_abort_soft (journal , errno );
2148
+ transaction_t * transaction ;
2149
+
2150
+ /*
2151
+ * ESHUTDOWN always takes precedence because a file system check
2152
+ * caused by any other journal abort error is not required after
2153
+ * a shutdown triggered.
2154
+ */
2155
+ write_lock (& journal -> j_state_lock );
2156
+ if (journal -> j_flags & JBD2_ABORT ) {
2157
+ int old_errno = journal -> j_errno ;
2158
+
2159
+ write_unlock (& journal -> j_state_lock );
2160
+ if (old_errno != - ESHUTDOWN && errno == - ESHUTDOWN ) {
2161
+ journal -> j_errno = errno ;
2162
+ jbd2_journal_update_sb_errno (journal );
2163
+ }
2164
+ return ;
2165
+ }
2166
+
2167
+ /*
2168
+ * Mark the abort as occurred and start current running transaction
2169
+ * to release all journaled buffer.
2170
+ */
2171
+ pr_err ("Aborting journal on device %s.\n" , journal -> j_devname );
2172
+
2173
+ journal -> j_flags |= JBD2_ABORT ;
2174
+ journal -> j_errno = errno ;
2175
+ transaction = journal -> j_running_transaction ;
2176
+ if (transaction )
2177
+ __jbd2_log_start_commit (journal , transaction -> t_tid );
2178
+ write_unlock (& journal -> j_state_lock );
2179
+
2180
+ /*
2181
+ * Record errno to the journal super block, so that fsck and jbd2
2182
+ * layer could realise that a filesystem check is needed.
2183
+ */
2184
+ jbd2_journal_update_sb_errno (journal );
2185
+
2186
+ write_lock (& journal -> j_state_lock );
2187
+ journal -> j_flags |= JBD2_REC_ERR ;
2188
+ write_unlock (& journal -> j_state_lock );
2208
2189
}
2209
2190
2210
2191
/**
0 commit comments