diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_file.c | 2 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 12 | ||||
-rw-r--r-- | fs/ext3/super.c | 23 | ||||
-rw-r--r-- | fs/jbd/checkpoint.c | 68 | ||||
-rw-r--r-- | fs/jbd/journal.c | 28 | ||||
-rw-r--r-- | fs/jbd/recovery.c | 7 | ||||
-rw-r--r-- | fs/nfsd/export.c | 19 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 4 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 6 |
9 files changed, 128 insertions, 41 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 041c52692284..68bf2af6c389 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -178,7 +178,7 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count, | |||
178 | int ret; | 178 | int ret; |
179 | struct p9_fid *fid; | 179 | struct p9_fid *fid; |
180 | 180 | ||
181 | P9_DPRINTK(P9_DEBUG_VFS, "count %d offset %lld\n", count, *offset); | 181 | P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset); |
182 | fid = filp->private_data; | 182 | fid = filp->private_data; |
183 | 183 | ||
184 | if (count > (fid->clnt->msize - P9_IOHDRSZ)) | 184 | if (count > (fid->clnt->msize - P9_IOHDRSZ)) |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 0d0c70151642..b7394d05ee8e 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -239,7 +239,7 @@ setrsvsz_out: | |||
239 | case EXT3_IOC_GROUP_EXTEND: { | 239 | case EXT3_IOC_GROUP_EXTEND: { |
240 | ext3_fsblk_t n_blocks_count; | 240 | ext3_fsblk_t n_blocks_count; |
241 | struct super_block *sb = inode->i_sb; | 241 | struct super_block *sb = inode->i_sb; |
242 | int err; | 242 | int err, err2; |
243 | 243 | ||
244 | if (!capable(CAP_SYS_RESOURCE)) | 244 | if (!capable(CAP_SYS_RESOURCE)) |
245 | return -EPERM; | 245 | return -EPERM; |
@@ -254,8 +254,10 @@ setrsvsz_out: | |||
254 | } | 254 | } |
255 | err = ext3_group_extend(sb, EXT3_SB(sb)->s_es, n_blocks_count); | 255 | err = ext3_group_extend(sb, EXT3_SB(sb)->s_es, n_blocks_count); |
256 | journal_lock_updates(EXT3_SB(sb)->s_journal); | 256 | journal_lock_updates(EXT3_SB(sb)->s_journal); |
257 | journal_flush(EXT3_SB(sb)->s_journal); | 257 | err2 = journal_flush(EXT3_SB(sb)->s_journal); |
258 | journal_unlock_updates(EXT3_SB(sb)->s_journal); | 258 | journal_unlock_updates(EXT3_SB(sb)->s_journal); |
259 | if (err == 0) | ||
260 | err = err2; | ||
259 | group_extend_out: | 261 | group_extend_out: |
260 | mnt_drop_write(filp->f_path.mnt); | 262 | mnt_drop_write(filp->f_path.mnt); |
261 | return err; | 263 | return err; |
@@ -263,7 +265,7 @@ group_extend_out: | |||
263 | case EXT3_IOC_GROUP_ADD: { | 265 | case EXT3_IOC_GROUP_ADD: { |
264 | struct ext3_new_group_data input; | 266 | struct ext3_new_group_data input; |
265 | struct super_block *sb = inode->i_sb; | 267 | struct super_block *sb = inode->i_sb; |
266 | int err; | 268 | int err, err2; |
267 | 269 | ||
268 | if (!capable(CAP_SYS_RESOURCE)) | 270 | if (!capable(CAP_SYS_RESOURCE)) |
269 | return -EPERM; | 271 | return -EPERM; |
@@ -280,8 +282,10 @@ group_extend_out: | |||
280 | 282 | ||
281 | err = ext3_group_add(sb, &input); | 283 | err = ext3_group_add(sb, &input); |
282 | journal_lock_updates(EXT3_SB(sb)->s_journal); | 284 | journal_lock_updates(EXT3_SB(sb)->s_journal); |
283 | journal_flush(EXT3_SB(sb)->s_journal); | 285 | err2 = journal_flush(EXT3_SB(sb)->s_journal); |
284 | journal_unlock_updates(EXT3_SB(sb)->s_journal); | 286 | journal_unlock_updates(EXT3_SB(sb)->s_journal); |
287 | if (err == 0) | ||
288 | err = err2; | ||
285 | group_add_out: | 289 | group_add_out: |
286 | mnt_drop_write(filp->f_path.mnt); | 290 | mnt_drop_write(filp->f_path.mnt); |
287 | return err; | 291 | return err; |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 5b7fee10566f..34b6fca765d7 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -393,7 +393,8 @@ static void ext3_put_super (struct super_block * sb) | |||
393 | int i; | 393 | int i; |
394 | 394 | ||
395 | ext3_xattr_put_super(sb); | 395 | ext3_xattr_put_super(sb); |
396 | journal_destroy(sbi->s_journal); | 396 | if (journal_destroy(sbi->s_journal) < 0) |
397 | ext3_abort(sb, __func__, "Couldn't clean up the journal"); | ||
397 | if (!(sb->s_flags & MS_RDONLY)) { | 398 | if (!(sb->s_flags & MS_RDONLY)) { |
398 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 399 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
399 | es->s_state = cpu_to_le16(sbi->s_mount_state); | 400 | es->s_state = cpu_to_le16(sbi->s_mount_state); |
@@ -2296,7 +2297,9 @@ static void ext3_mark_recovery_complete(struct super_block * sb, | |||
2296 | journal_t *journal = EXT3_SB(sb)->s_journal; | 2297 | journal_t *journal = EXT3_SB(sb)->s_journal; |
2297 | 2298 | ||
2298 | journal_lock_updates(journal); | 2299 | journal_lock_updates(journal); |
2299 | journal_flush(journal); | 2300 | if (journal_flush(journal) < 0) |
2301 | goto out; | ||
2302 | |||
2300 | lock_super(sb); | 2303 | lock_super(sb); |
2301 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && | 2304 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && |
2302 | sb->s_flags & MS_RDONLY) { | 2305 | sb->s_flags & MS_RDONLY) { |
@@ -2305,6 +2308,8 @@ static void ext3_mark_recovery_complete(struct super_block * sb, | |||
2305 | ext3_commit_super(sb, es, 1); | 2308 | ext3_commit_super(sb, es, 1); |
2306 | } | 2309 | } |
2307 | unlock_super(sb); | 2310 | unlock_super(sb); |
2311 | |||
2312 | out: | ||
2308 | journal_unlock_updates(journal); | 2313 | journal_unlock_updates(journal); |
2309 | } | 2314 | } |
2310 | 2315 | ||
@@ -2404,7 +2409,13 @@ static void ext3_write_super_lockfs(struct super_block *sb) | |||
2404 | 2409 | ||
2405 | /* Now we set up the journal barrier. */ | 2410 | /* Now we set up the journal barrier. */ |
2406 | journal_lock_updates(journal); | 2411 | journal_lock_updates(journal); |
2407 | journal_flush(journal); | 2412 | |
2413 | /* | ||
2414 | * We don't want to clear needs_recovery flag when we failed | ||
2415 | * to flush the journal. | ||
2416 | */ | ||
2417 | if (journal_flush(journal) < 0) | ||
2418 | return; | ||
2408 | 2419 | ||
2409 | /* Journal blocked and flushed, clear needs_recovery flag. */ | 2420 | /* Journal blocked and flushed, clear needs_recovery flag. */ |
2410 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 2421 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
@@ -2822,8 +2833,12 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
2822 | * otherwise be livelocked... | 2833 | * otherwise be livelocked... |
2823 | */ | 2834 | */ |
2824 | journal_lock_updates(EXT3_SB(sb)->s_journal); | 2835 | journal_lock_updates(EXT3_SB(sb)->s_journal); |
2825 | journal_flush(EXT3_SB(sb)->s_journal); | 2836 | err = journal_flush(EXT3_SB(sb)->s_journal); |
2826 | journal_unlock_updates(EXT3_SB(sb)->s_journal); | 2837 | journal_unlock_updates(EXT3_SB(sb)->s_journal); |
2838 | if (err) { | ||
2839 | path_put(&nd.path); | ||
2840 | return err; | ||
2841 | } | ||
2827 | } | 2842 | } |
2828 | 2843 | ||
2829 | err = vfs_quota_on_path(sb, type, format_id, &path); | 2844 | err = vfs_quota_on_path(sb, type, format_id, &path); |
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index a5432bbbfb88..1bd8d4acc6f2 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c | |||
@@ -93,7 +93,8 @@ static int __try_to_free_cp_buf(struct journal_head *jh) | |||
93 | int ret = 0; | 93 | int ret = 0; |
94 | struct buffer_head *bh = jh2bh(jh); | 94 | struct buffer_head *bh = jh2bh(jh); |
95 | 95 | ||
96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { | 96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && |
97 | !buffer_dirty(bh) && !buffer_write_io_error(bh)) { | ||
97 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 98 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
98 | ret = __journal_remove_checkpoint(jh) + 1; | 99 | ret = __journal_remove_checkpoint(jh) + 1; |
99 | jbd_unlock_bh_state(bh); | 100 | jbd_unlock_bh_state(bh); |
@@ -126,14 +127,29 @@ void __log_wait_for_space(journal_t *journal) | |||
126 | 127 | ||
127 | /* | 128 | /* |
128 | * Test again, another process may have checkpointed while we | 129 | * Test again, another process may have checkpointed while we |
129 | * were waiting for the checkpoint lock | 130 | * were waiting for the checkpoint lock. If there are no |
131 | * outstanding transactions there is nothing to checkpoint and | ||
132 | * we can't make progress. Abort the journal in this case. | ||
130 | */ | 133 | */ |
131 | spin_lock(&journal->j_state_lock); | 134 | spin_lock(&journal->j_state_lock); |
135 | spin_lock(&journal->j_list_lock); | ||
132 | nblocks = jbd_space_needed(journal); | 136 | nblocks = jbd_space_needed(journal); |
133 | if (__log_space_left(journal) < nblocks) { | 137 | if (__log_space_left(journal) < nblocks) { |
138 | int chkpt = journal->j_checkpoint_transactions != NULL; | ||
139 | |||
140 | spin_unlock(&journal->j_list_lock); | ||
134 | spin_unlock(&journal->j_state_lock); | 141 | spin_unlock(&journal->j_state_lock); |
135 | log_do_checkpoint(journal); | 142 | if (chkpt) { |
143 | log_do_checkpoint(journal); | ||
144 | } else { | ||
145 | printk(KERN_ERR "%s: no transactions\n", | ||
146 | __func__); | ||
147 | journal_abort(journal, 0); | ||
148 | } | ||
149 | |||
136 | spin_lock(&journal->j_state_lock); | 150 | spin_lock(&journal->j_state_lock); |
151 | } else { | ||
152 | spin_unlock(&journal->j_list_lock); | ||
137 | } | 153 | } |
138 | mutex_unlock(&journal->j_checkpoint_mutex); | 154 | mutex_unlock(&journal->j_checkpoint_mutex); |
139 | } | 155 | } |
@@ -160,21 +176,25 @@ static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh) | |||
160 | * buffers. Note that we take the buffers in the opposite ordering | 176 | * buffers. Note that we take the buffers in the opposite ordering |
161 | * from the one in which they were submitted for IO. | 177 | * from the one in which they were submitted for IO. |
162 | * | 178 | * |
179 | * Return 0 on success, and return <0 if some buffers have failed | ||
180 | * to be written out. | ||
181 | * | ||
163 | * Called with j_list_lock held. | 182 | * Called with j_list_lock held. |
164 | */ | 183 | */ |
165 | static void __wait_cp_io(journal_t *journal, transaction_t *transaction) | 184 | static int __wait_cp_io(journal_t *journal, transaction_t *transaction) |
166 | { | 185 | { |
167 | struct journal_head *jh; | 186 | struct journal_head *jh; |
168 | struct buffer_head *bh; | 187 | struct buffer_head *bh; |
169 | tid_t this_tid; | 188 | tid_t this_tid; |
170 | int released = 0; | 189 | int released = 0; |
190 | int ret = 0; | ||
171 | 191 | ||
172 | this_tid = transaction->t_tid; | 192 | this_tid = transaction->t_tid; |
173 | restart: | 193 | restart: |
174 | /* Did somebody clean up the transaction in the meanwhile? */ | 194 | /* Did somebody clean up the transaction in the meanwhile? */ |
175 | if (journal->j_checkpoint_transactions != transaction || | 195 | if (journal->j_checkpoint_transactions != transaction || |
176 | transaction->t_tid != this_tid) | 196 | transaction->t_tid != this_tid) |
177 | return; | 197 | return ret; |
178 | while (!released && transaction->t_checkpoint_io_list) { | 198 | while (!released && transaction->t_checkpoint_io_list) { |
179 | jh = transaction->t_checkpoint_io_list; | 199 | jh = transaction->t_checkpoint_io_list; |
180 | bh = jh2bh(jh); | 200 | bh = jh2bh(jh); |
@@ -194,6 +214,9 @@ restart: | |||
194 | spin_lock(&journal->j_list_lock); | 214 | spin_lock(&journal->j_list_lock); |
195 | goto restart; | 215 | goto restart; |
196 | } | 216 | } |
217 | if (unlikely(buffer_write_io_error(bh))) | ||
218 | ret = -EIO; | ||
219 | |||
197 | /* | 220 | /* |
198 | * Now in whatever state the buffer currently is, we know that | 221 | * Now in whatever state the buffer currently is, we know that |
199 | * it has been written out and so we can drop it from the list | 222 | * it has been written out and so we can drop it from the list |
@@ -203,6 +226,8 @@ restart: | |||
203 | journal_remove_journal_head(bh); | 226 | journal_remove_journal_head(bh); |
204 | __brelse(bh); | 227 | __brelse(bh); |
205 | } | 228 | } |
229 | |||
230 | return ret; | ||
206 | } | 231 | } |
207 | 232 | ||
208 | #define NR_BATCH 64 | 233 | #define NR_BATCH 64 |
@@ -226,7 +251,8 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) | |||
226 | * Try to flush one buffer from the checkpoint list to disk. | 251 | * Try to flush one buffer from the checkpoint list to disk. |
227 | * | 252 | * |
228 | * Return 1 if something happened which requires us to abort the current | 253 | * Return 1 if something happened which requires us to abort the current |
229 | * scan of the checkpoint list. | 254 | * scan of the checkpoint list. Return <0 if the buffer has failed to |
255 | * be written out. | ||
230 | * | 256 | * |
231 | * Called with j_list_lock held and drops it if 1 is returned | 257 | * Called with j_list_lock held and drops it if 1 is returned |
232 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it | 258 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
@@ -256,6 +282,9 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
256 | log_wait_commit(journal, tid); | 282 | log_wait_commit(journal, tid); |
257 | ret = 1; | 283 | ret = 1; |
258 | } else if (!buffer_dirty(bh)) { | 284 | } else if (!buffer_dirty(bh)) { |
285 | ret = 1; | ||
286 | if (unlikely(buffer_write_io_error(bh))) | ||
287 | ret = -EIO; | ||
259 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); | 288 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); |
260 | BUFFER_TRACE(bh, "remove from checkpoint"); | 289 | BUFFER_TRACE(bh, "remove from checkpoint"); |
261 | __journal_remove_checkpoint(jh); | 290 | __journal_remove_checkpoint(jh); |
@@ -263,7 +292,6 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
263 | jbd_unlock_bh_state(bh); | 292 | jbd_unlock_bh_state(bh); |
264 | journal_remove_journal_head(bh); | 293 | journal_remove_journal_head(bh); |
265 | __brelse(bh); | 294 | __brelse(bh); |
266 | ret = 1; | ||
267 | } else { | 295 | } else { |
268 | /* | 296 | /* |
269 | * Important: we are about to write the buffer, and | 297 | * Important: we are about to write the buffer, and |
@@ -295,6 +323,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
295 | * to disk. We submit larger chunks of data at once. | 323 | * to disk. We submit larger chunks of data at once. |
296 | * | 324 | * |
297 | * The journal should be locked before calling this function. | 325 | * The journal should be locked before calling this function. |
326 | * Called with j_checkpoint_mutex held. | ||
298 | */ | 327 | */ |
299 | int log_do_checkpoint(journal_t *journal) | 328 | int log_do_checkpoint(journal_t *journal) |
300 | { | 329 | { |
@@ -318,6 +347,7 @@ int log_do_checkpoint(journal_t *journal) | |||
318 | * OK, we need to start writing disk blocks. Take one transaction | 347 | * OK, we need to start writing disk blocks. Take one transaction |
319 | * and write it. | 348 | * and write it. |
320 | */ | 349 | */ |
350 | result = 0; | ||
321 | spin_lock(&journal->j_list_lock); | 351 | spin_lock(&journal->j_list_lock); |
322 | if (!journal->j_checkpoint_transactions) | 352 | if (!journal->j_checkpoint_transactions) |
323 | goto out; | 353 | goto out; |
@@ -334,7 +364,7 @@ restart: | |||
334 | int batch_count = 0; | 364 | int batch_count = 0; |
335 | struct buffer_head *bhs[NR_BATCH]; | 365 | struct buffer_head *bhs[NR_BATCH]; |
336 | struct journal_head *jh; | 366 | struct journal_head *jh; |
337 | int retry = 0; | 367 | int retry = 0, err; |
338 | 368 | ||
339 | while (!retry && transaction->t_checkpoint_list) { | 369 | while (!retry && transaction->t_checkpoint_list) { |
340 | struct buffer_head *bh; | 370 | struct buffer_head *bh; |
@@ -347,6 +377,8 @@ restart: | |||
347 | break; | 377 | break; |
348 | } | 378 | } |
349 | retry = __process_buffer(journal, jh, bhs,&batch_count); | 379 | retry = __process_buffer(journal, jh, bhs,&batch_count); |
380 | if (retry < 0 && !result) | ||
381 | result = retry; | ||
350 | if (!retry && (need_resched() || | 382 | if (!retry && (need_resched() || |
351 | spin_needbreak(&journal->j_list_lock))) { | 383 | spin_needbreak(&journal->j_list_lock))) { |
352 | spin_unlock(&journal->j_list_lock); | 384 | spin_unlock(&journal->j_list_lock); |
@@ -371,14 +403,18 @@ restart: | |||
371 | * Now we have cleaned up the first transaction's checkpoint | 403 | * Now we have cleaned up the first transaction's checkpoint |
372 | * list. Let's clean up the second one | 404 | * list. Let's clean up the second one |
373 | */ | 405 | */ |
374 | __wait_cp_io(journal, transaction); | 406 | err = __wait_cp_io(journal, transaction); |
407 | if (!result) | ||
408 | result = err; | ||
375 | } | 409 | } |
376 | out: | 410 | out: |
377 | spin_unlock(&journal->j_list_lock); | 411 | spin_unlock(&journal->j_list_lock); |
378 | result = cleanup_journal_tail(journal); | ||
379 | if (result < 0) | 412 | if (result < 0) |
380 | return result; | 413 | journal_abort(journal, result); |
381 | return 0; | 414 | else |
415 | result = cleanup_journal_tail(journal); | ||
416 | |||
417 | return (result < 0) ? result : 0; | ||
382 | } | 418 | } |
383 | 419 | ||
384 | /* | 420 | /* |
@@ -394,8 +430,9 @@ out: | |||
394 | * This is the only part of the journaling code which really needs to be | 430 | * This is the only part of the journaling code which really needs to be |
395 | * aware of transaction aborts. Checkpointing involves writing to the | 431 | * aware of transaction aborts. Checkpointing involves writing to the |
396 | * main filesystem area rather than to the journal, so it can proceed | 432 | * main filesystem area rather than to the journal, so it can proceed |
397 | * even in abort state, but we must not update the journal superblock if | 433 | * even in abort state, but we must not update the super block if |
398 | * we have an abort error outstanding. | 434 | * checkpointing may have failed. Otherwise, we would lose some metadata |
435 | * buffers which should be written-back to the filesystem. | ||
399 | */ | 436 | */ |
400 | 437 | ||
401 | int cleanup_journal_tail(journal_t *journal) | 438 | int cleanup_journal_tail(journal_t *journal) |
@@ -404,6 +441,9 @@ int cleanup_journal_tail(journal_t *journal) | |||
404 | tid_t first_tid; | 441 | tid_t first_tid; |
405 | unsigned long blocknr, freed; | 442 | unsigned long blocknr, freed; |
406 | 443 | ||
444 | if (is_journal_aborted(journal)) | ||
445 | return 1; | ||
446 | |||
407 | /* OK, work out the oldest transaction remaining in the log, and | 447 | /* OK, work out the oldest transaction remaining in the log, and |
408 | * the log block it starts at. | 448 | * the log block it starts at. |
409 | * | 449 | * |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index aa7143a8349b..9e4fa52d7dc8 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -1121,9 +1121,12 @@ recovery_error: | |||
1121 | * | 1121 | * |
1122 | * Release a journal_t structure once it is no longer in use by the | 1122 | * Release a journal_t structure once it is no longer in use by the |
1123 | * journaled object. | 1123 | * journaled object. |
1124 | * Return <0 if we couldn't clean up the journal. | ||
1124 | */ | 1125 | */ |
1125 | void journal_destroy(journal_t *journal) | 1126 | int journal_destroy(journal_t *journal) |
1126 | { | 1127 | { |
1128 | int err = 0; | ||
1129 | |||
1127 | /* Wait for the commit thread to wake up and die. */ | 1130 | /* Wait for the commit thread to wake up and die. */ |
1128 | journal_kill_thread(journal); | 1131 | journal_kill_thread(journal); |
1129 | 1132 | ||
@@ -1146,11 +1149,16 @@ void journal_destroy(journal_t *journal) | |||
1146 | J_ASSERT(journal->j_checkpoint_transactions == NULL); | 1149 | J_ASSERT(journal->j_checkpoint_transactions == NULL); |
1147 | spin_unlock(&journal->j_list_lock); | 1150 | spin_unlock(&journal->j_list_lock); |
1148 | 1151 | ||
1149 | /* We can now mark the journal as empty. */ | ||
1150 | journal->j_tail = 0; | ||
1151 | journal->j_tail_sequence = ++journal->j_transaction_sequence; | ||
1152 | if (journal->j_sb_buffer) { | 1152 | if (journal->j_sb_buffer) { |
1153 | journal_update_superblock(journal, 1); | 1153 | if (!is_journal_aborted(journal)) { |
1154 | /* We can now mark the journal as empty. */ | ||
1155 | journal->j_tail = 0; | ||
1156 | journal->j_tail_sequence = | ||
1157 | ++journal->j_transaction_sequence; | ||
1158 | journal_update_superblock(journal, 1); | ||
1159 | } else { | ||
1160 | err = -EIO; | ||
1161 | } | ||
1154 | brelse(journal->j_sb_buffer); | 1162 | brelse(journal->j_sb_buffer); |
1155 | } | 1163 | } |
1156 | 1164 | ||
@@ -1160,6 +1168,8 @@ void journal_destroy(journal_t *journal) | |||
1160 | journal_destroy_revoke(journal); | 1168 | journal_destroy_revoke(journal); |
1161 | kfree(journal->j_wbuf); | 1169 | kfree(journal->j_wbuf); |
1162 | kfree(journal); | 1170 | kfree(journal); |
1171 | |||
1172 | return err; | ||
1163 | } | 1173 | } |
1164 | 1174 | ||
1165 | 1175 | ||
@@ -1359,10 +1369,16 @@ int journal_flush(journal_t *journal) | |||
1359 | spin_lock(&journal->j_list_lock); | 1369 | spin_lock(&journal->j_list_lock); |
1360 | while (!err && journal->j_checkpoint_transactions != NULL) { | 1370 | while (!err && journal->j_checkpoint_transactions != NULL) { |
1361 | spin_unlock(&journal->j_list_lock); | 1371 | spin_unlock(&journal->j_list_lock); |
1372 | mutex_lock(&journal->j_checkpoint_mutex); | ||
1362 | err = log_do_checkpoint(journal); | 1373 | err = log_do_checkpoint(journal); |
1374 | mutex_unlock(&journal->j_checkpoint_mutex); | ||
1363 | spin_lock(&journal->j_list_lock); | 1375 | spin_lock(&journal->j_list_lock); |
1364 | } | 1376 | } |
1365 | spin_unlock(&journal->j_list_lock); | 1377 | spin_unlock(&journal->j_list_lock); |
1378 | |||
1379 | if (is_journal_aborted(journal)) | ||
1380 | return -EIO; | ||
1381 | |||
1366 | cleanup_journal_tail(journal); | 1382 | cleanup_journal_tail(journal); |
1367 | 1383 | ||
1368 | /* Finally, mark the journal as really needing no recovery. | 1384 | /* Finally, mark the journal as really needing no recovery. |
@@ -1384,7 +1400,7 @@ int journal_flush(journal_t *journal) | |||
1384 | J_ASSERT(journal->j_head == journal->j_tail); | 1400 | J_ASSERT(journal->j_head == journal->j_tail); |
1385 | J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); | 1401 | J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); |
1386 | spin_unlock(&journal->j_state_lock); | 1402 | spin_unlock(&journal->j_state_lock); |
1387 | return err; | 1403 | return 0; |
1388 | } | 1404 | } |
1389 | 1405 | ||
1390 | /** | 1406 | /** |
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index 43bc5e5ed064..db5e982c5ddf 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c | |||
@@ -223,7 +223,7 @@ do { \ | |||
223 | */ | 223 | */ |
224 | int journal_recover(journal_t *journal) | 224 | int journal_recover(journal_t *journal) |
225 | { | 225 | { |
226 | int err; | 226 | int err, err2; |
227 | journal_superblock_t * sb; | 227 | journal_superblock_t * sb; |
228 | 228 | ||
229 | struct recovery_info info; | 229 | struct recovery_info info; |
@@ -261,7 +261,10 @@ int journal_recover(journal_t *journal) | |||
261 | journal->j_transaction_sequence = ++info.end_transaction; | 261 | journal->j_transaction_sequence = ++info.end_transaction; |
262 | 262 | ||
263 | journal_clear_revoke(journal); | 263 | journal_clear_revoke(journal); |
264 | sync_blockdev(journal->j_fs_dev); | 264 | err2 = sync_blockdev(journal->j_fs_dev); |
265 | if (!err) | ||
266 | err = err2; | ||
267 | |||
265 | return err; | 268 | return err; |
266 | } | 269 | } |
267 | 270 | ||
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 676201dbdf84..5839b229cd0e 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -99,7 +99,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
99 | int fsidtype; | 99 | int fsidtype; |
100 | char *ep; | 100 | char *ep; |
101 | struct svc_expkey key; | 101 | struct svc_expkey key; |
102 | struct svc_expkey *ek; | 102 | struct svc_expkey *ek = NULL; |
103 | 103 | ||
104 | if (mesg[mlen-1] != '\n') | 104 | if (mesg[mlen-1] != '\n') |
105 | return -EINVAL; | 105 | return -EINVAL; |
@@ -107,7 +107,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
107 | 107 | ||
108 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | 108 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
109 | err = -ENOMEM; | 109 | err = -ENOMEM; |
110 | if (!buf) goto out; | 110 | if (!buf) |
111 | goto out; | ||
111 | 112 | ||
112 | err = -EINVAL; | 113 | err = -EINVAL; |
113 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) | 114 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) |
@@ -151,16 +152,16 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
151 | 152 | ||
152 | /* now we want a pathname, or empty meaning NEGATIVE */ | 153 | /* now we want a pathname, or empty meaning NEGATIVE */ |
153 | err = -EINVAL; | 154 | err = -EINVAL; |
154 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) < 0) | 155 | len = qword_get(&mesg, buf, PAGE_SIZE); |
156 | if (len < 0) | ||
155 | goto out; | 157 | goto out; |
156 | dprintk("Path seems to be <%s>\n", buf); | 158 | dprintk("Path seems to be <%s>\n", buf); |
157 | err = 0; | 159 | err = 0; |
158 | if (len == 0) { | 160 | if (len == 0) { |
159 | set_bit(CACHE_NEGATIVE, &key.h.flags); | 161 | set_bit(CACHE_NEGATIVE, &key.h.flags); |
160 | ek = svc_expkey_update(&key, ek); | 162 | ek = svc_expkey_update(&key, ek); |
161 | if (ek) | 163 | if (!ek) |
162 | cache_put(&ek->h, &svc_expkey_cache); | 164 | err = -ENOMEM; |
163 | else err = -ENOMEM; | ||
164 | } else { | 165 | } else { |
165 | err = kern_path(buf, 0, &key.ek_path); | 166 | err = kern_path(buf, 0, &key.ek_path); |
166 | if (err) | 167 | if (err) |
@@ -169,14 +170,14 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
169 | dprintk("Found the path %s\n", buf); | 170 | dprintk("Found the path %s\n", buf); |
170 | 171 | ||
171 | ek = svc_expkey_update(&key, ek); | 172 | ek = svc_expkey_update(&key, ek); |
172 | if (ek) | 173 | if (!ek) |
173 | cache_put(&ek->h, &svc_expkey_cache); | ||
174 | else | ||
175 | err = -ENOMEM; | 174 | err = -ENOMEM; |
176 | path_put(&key.ek_path); | 175 | path_put(&key.ek_path); |
177 | } | 176 | } |
178 | cache_flush(); | 177 | cache_flush(); |
179 | out: | 178 | out: |
179 | if (ek) | ||
180 | cache_put(&ek->h, &svc_expkey_cache); | ||
180 | if (dom) | 181 | if (dom) |
181 | auth_domain_put(dom); | 182 | auth_domain_put(dom); |
182 | kfree(buf); | 183 | kfree(buf); |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 59eeb46f82c5..07e4f5d7baa8 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -249,6 +249,10 @@ static int nfsd_init_socks(int port) | |||
249 | if (error < 0) | 249 | if (error < 0) |
250 | return error; | 250 | return error; |
251 | 251 | ||
252 | error = lockd_up(); | ||
253 | if (error < 0) | ||
254 | return error; | ||
255 | |||
252 | error = svc_create_xprt(nfsd_serv, "tcp", port, | 256 | error = svc_create_xprt(nfsd_serv, "tcp", port, |
253 | SVC_SOCK_DEFAULTS); | 257 | SVC_SOCK_DEFAULTS); |
254 | if (error < 0) | 258 | if (error < 0) |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 49d4b8725ca3..0bc56f6d9276 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -410,6 +410,7 @@ out_nfserr: | |||
410 | static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) | 410 | static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) |
411 | { | 411 | { |
412 | ssize_t buflen; | 412 | ssize_t buflen; |
413 | ssize_t ret; | ||
413 | 414 | ||
414 | buflen = vfs_getxattr(dentry, key, NULL, 0); | 415 | buflen = vfs_getxattr(dentry, key, NULL, 0); |
415 | if (buflen <= 0) | 416 | if (buflen <= 0) |
@@ -419,7 +420,10 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) | |||
419 | if (!*buf) | 420 | if (!*buf) |
420 | return -ENOMEM; | 421 | return -ENOMEM; |
421 | 422 | ||
422 | return vfs_getxattr(dentry, key, *buf, buflen); | 423 | ret = vfs_getxattr(dentry, key, *buf, buflen); |
424 | if (ret < 0) | ||
425 | kfree(*buf); | ||
426 | return ret; | ||
423 | } | 427 | } |
424 | #endif | 428 | #endif |
425 | 429 | ||