diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_sync.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 320be6aea492..961df0a22c78 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -309,11 +309,15 @@ xfs_sync_attr( | |||
309 | STATIC int | 309 | STATIC int |
310 | xfs_commit_dummy_trans( | 310 | xfs_commit_dummy_trans( |
311 | struct xfs_mount *mp, | 311 | struct xfs_mount *mp, |
312 | uint log_flags) | 312 | uint flags) |
313 | { | 313 | { |
314 | struct xfs_inode *ip = mp->m_rootip; | 314 | struct xfs_inode *ip = mp->m_rootip; |
315 | struct xfs_trans *tp; | 315 | struct xfs_trans *tp; |
316 | int error; | 316 | int error; |
317 | int log_flags = XFS_LOG_FORCE; | ||
318 | |||
319 | if (flags & SYNC_WAIT) | ||
320 | log_flags |= XFS_LOG_SYNC; | ||
317 | 321 | ||
318 | /* | 322 | /* |
319 | * Put a dummy transaction in the log to tell recovery | 323 | * Put a dummy transaction in the log to tell recovery |
@@ -331,13 +335,12 @@ xfs_commit_dummy_trans( | |||
331 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 335 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
332 | xfs_trans_ihold(tp, ip); | 336 | xfs_trans_ihold(tp, ip); |
333 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 337 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
334 | /* XXX(hch): ignoring the error here.. */ | ||
335 | error = xfs_trans_commit(tp, 0); | 338 | error = xfs_trans_commit(tp, 0); |
336 | |||
337 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 339 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
338 | 340 | ||
341 | /* the log force ensures this transaction is pushed to disk */ | ||
339 | xfs_log_force(mp, 0, log_flags); | 342 | xfs_log_force(mp, 0, log_flags); |
340 | return 0; | 343 | return error; |
341 | } | 344 | } |
342 | 345 | ||
343 | int | 346 | int |
@@ -385,7 +388,20 @@ xfs_sync_fsdata( | |||
385 | else | 388 | else |
386 | XFS_BUF_ASYNC(bp); | 389 | XFS_BUF_ASYNC(bp); |
387 | 390 | ||
388 | return xfs_bwrite(mp, bp); | 391 | error = xfs_bwrite(mp, bp); |
392 | if (error) | ||
393 | return error; | ||
394 | |||
395 | /* | ||
396 | * If this is a data integrity sync make sure all pending buffers | ||
397 | * are flushed out for the log coverage check below. | ||
398 | */ | ||
399 | if (flags & SYNC_WAIT) | ||
400 | xfs_flush_buftarg(mp->m_ddev_targp, 1); | ||
401 | |||
402 | if (xfs_log_need_covered(mp)) | ||
403 | error = xfs_commit_dummy_trans(mp, flags); | ||
404 | return error; | ||
389 | 405 | ||
390 | out_brelse: | 406 | out_brelse: |
391 | xfs_buf_relse(bp); | 407 | xfs_buf_relse(bp); |
@@ -419,14 +435,16 @@ xfs_quiesce_data( | |||
419 | /* push non-blocking */ | 435 | /* push non-blocking */ |
420 | xfs_sync_data(mp, 0); | 436 | xfs_sync_data(mp, 0); |
421 | xfs_qm_sync(mp, SYNC_TRYLOCK); | 437 | xfs_qm_sync(mp, SYNC_TRYLOCK); |
422 | xfs_filestream_flush(mp); | ||
423 | 438 | ||
424 | /* push and block */ | 439 | /* push and block till complete */ |
425 | xfs_sync_data(mp, SYNC_WAIT); | 440 | xfs_sync_data(mp, SYNC_WAIT); |
426 | xfs_qm_sync(mp, SYNC_WAIT); | 441 | xfs_qm_sync(mp, SYNC_WAIT); |
427 | 442 | ||
443 | /* drop inode references pinned by filestreams */ | ||
444 | xfs_filestream_flush(mp); | ||
445 | |||
428 | /* write superblock and hoover up shutdown errors */ | 446 | /* write superblock and hoover up shutdown errors */ |
429 | error = xfs_sync_fsdata(mp, 0); | 447 | error = xfs_sync_fsdata(mp, SYNC_WAIT); |
430 | 448 | ||
431 | /* flush data-only devices */ | 449 | /* flush data-only devices */ |
432 | if (mp->m_rtdev_targp) | 450 | if (mp->m_rtdev_targp) |
@@ -570,8 +588,6 @@ xfs_sync_worker( | |||
570 | /* dgc: errors ignored here */ | 588 | /* dgc: errors ignored here */ |
571 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); | 589 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
572 | error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); | 590 | error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); |
573 | if (xfs_log_need_covered(mp)) | ||
574 | error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); | ||
575 | } | 591 | } |
576 | mp->m_sync_seq++; | 592 | mp->m_sync_seq++; |
577 | wake_up(&mp->m_wait_single_sync_task); | 593 | wake_up(&mp->m_wait_single_sync_task); |