Bug 15282 - Sync(2) blocked when syncing XFS
Summary: Sync(2) blocked when syncing XFS
Status: RESOLVED INVALID
Alias: None
Product: File System
Classification: Unclassified
Component: XFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Christoph Hellwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-12 09:53 UTC by Frank
Modified: 2010-08-31 21:41 UTC (History)
1 user (show)

See Also:
Kernel Version:
Tree: Mainline
Regression: No


Attachments
SysRq : Show Blocked State (3.22 KB, text/plain)
2010-02-12 09:59 UTC, Frank
Details

Description Frank 2010-02-12 09:53:42 UTC
Hello,
I have a Fedora 9 ( kernel 2.6.27.25-113 ). Every 30s a file is updated on a XFS partition ( including mounting/unmounting ). Every 3 seconds and before every unmount sync(2) is called.
The blocking happens sometimes when pulling out a FAT Usb-Stick while writing to it. While writing to the Usb sync(2) is not called, but once its pulled out these calls are executed again.

I got this call trace from my program when it got blocked
t_dso         D 00000000     0  7543   7418
       f30b2380 00000082 f336f400 00000000 f336f580 5b52c357 0000008f f6ccf000 
       f336f580 00000001 f6d2b800 f6d1a1f8 7fffffff f36e2f20 00000002 c0674934 
       c05b5407 f6cd48e0 f6ccf0ac f6cd49d8 f6ccf138 f6ccf024 f6d1a1f8 7fffffff 
Call Trace:
 [<c0674934>] schedule_timeout+0x13/0x8d
 [<c05b5407>] scsi_request_fn+0x390/0x3de
 [<c067483e>] wait_for_common+0xc8/0x13f
 [<c0416e7e>] default_wake_function+0x0/0x8
 [<c0502dda>] xfs_buf_iowait+0x1c/0x25
 [<c0500892>] xfs_bwrite+0x5e/0x89
 [<c04fbe33>] xfs_syncsub+0x10a/0x205
 [<c0508748>] xfs_fs_sync_super+0x2a/0xc3
 [<c04fbe56>] xfs_syncsub+0x12d/0x205
 [<c04773da>] sync_filesystems+0xa6/0x100
 [<c049247d>] do_sync+0x2e/0x55
 [<c04924ae>] sys_sync+0xa/0x10
 [<c0403a6e>] syscall_call+0x7/0xb

Thanks in advance. If you need further information please don't hesitate to ask.
Cheers,
Frank
Comment 1 Frank 2010-02-12 09:59:41 UTC
Created attachment 24999 [details]
SysRq : Show Blocked State

Update:
After suspending calls to sync(2) some seconds after pulling out the Usb I got a different kind of problem.

Instead of the sync(2) call being blocked umount got blocked ( for call trace see the attachment )
Comment 2 Christoph Hellwig 2010-02-12 11:49:29 UTC
Linux 2.6.27 is 1 1/2 years old, and the sync code has been entirely rewritten since.  Please try with Linux 2.6.32 or Linux 2.6.33-rc and report back.
Comment 3 Christoph Hellwig 2010-02-12 11:50:47 UTC
Btw, just to make sure, the usb stick beeing unplugged is a different device and not the xfs filesystem that's getting stuck?
Comment 4 Frank 2010-02-12 12:11:21 UTC
(In reply to comment #3)
> Btw, just to make sure, the usb stick beeing unplugged is a different device
> and not the xfs filesystem that's getting stuck?

Thanks for the quick reply, I will try with newer kernel.

The Usb stick is a FAT stick. 
There is a delay of about 5 seconds between pulling the Usb and system getting stuck. 
Pulling that Usb stick while writing to it seems to trigger that problem if a sync(2) is followed close after.
Comment 5 Christoph Hellwig 2010-08-31 21:41:11 UTC
The way sync(2) works is that it walks through all mounted filesystem.  If a pulled FAT usb sticks prevents sync from completing that's not an xfs issue but one in fatfs - probably not even one that can easily be solved.

Note You need to log in before you can comment on or make changes to this bug.