All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] splice: i_mutex vs splice write deadlock V2
@ 2011-08-08  6:45 ` Dave Chinner
  0 siblings, 0 replies; 22+ messages in thread
From: Dave Chinner @ 2011-08-08  6:45 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel

generic_file_splice_write() takes the inode->i_mutex after the
filesystem has taken whatever locks it needs to ensure sanity.
however, this typically violates the locking order of filesystems
with their own locks in that the order is usually i_mutex ->
filesystem lock.

XFS is such a case, and generic_file_splice_write() is generating
lockdep warnings because of lock inversions between the
inode->i_mutex and the XFS_I(inode)->i_iolock. There is also a
reported case of fio causing a deadlock when it mixes IO types
(e.g. splice vs direct IO).

Version 2:
- add a new function to take an actor to do the work of splicing the
  data to the file. Convert generic_file_splice_write to use this,
  and make XFS call it with a different actor fuction that avoids
  the i_mutex.

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/2] splice: fix direct IO/splice deadlock
@ 2012-11-28  2:12 Dave Chinner
  2012-11-28  2:12   ` Dave Chinner
  0 siblings, 1 reply; 22+ messages in thread
From: Dave Chinner @ 2012-11-28  2:12 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: xfs

Hi Folks,

These two patches have been sitting in my tree for some time. I think I've even
posted them before. Basically, XFS can deadlock when you use splice and direct
IO on the same file concurrently because the splice write inverts the locking
order of the i_mutex and the xfs inode i_iolock. The first patch moves the guts
of the i_mutex protected region of the splice write to an actor function, and
the second uses this structure to enable XFS to provide an actor that uses the
correct locking order and hence avoid the deadlock.

Comments?

Cheers,

Dave.


^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/2] splice: i_mutex vs splice write deadlock
@ 2011-07-18  4:04 Dave Chinner
  2011-07-18  4:04   ` Dave Chinner
  0 siblings, 1 reply; 22+ messages in thread
From: Dave Chinner @ 2011-07-18  4:04 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, xfs

generic_file_splice_write() takes the inode->i_mutex after the
filesystem has taken whatever locks it needs to ensure sanity.
however, this typically violates the locking order of filesystems
with their own locks in that the order is usually i_mutex ->
filesystem lock.

XFS is such a case, and generic_file_splice_write() is generating
lockdep warnings because of lock inversions between the
inode->i_mutex and the XFS_I(inode)->i_iolock. There is also a
reported case of fio causing a deadlock when it mixes IO types
(e.g. splice vs direct IO).

This patch set introduces generic_file_splice_write_unlocked() and
factors the code such that __generic_file_splice_write() will only
lock the i_mutex if called from the locked variant. The second patch
modifies XFS to use the new function.


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-11-28 21:33 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08  6:45 [PATCH 0/2] splice: i_mutex vs splice write deadlock V2 Dave Chinner
2011-08-08  6:45 ` Dave Chinner
2011-08-08  6:45 ` [PATCH 1/2] vfs: split generic splice code from i_mutex locking Dave Chinner
2011-08-08  6:45   ` Dave Chinner
2011-08-09 11:36   ` Jan Kara
2011-08-09 11:36     ` Jan Kara
2011-08-10 10:12   ` Christoph Hellwig
2011-08-10 10:12     ` Christoph Hellwig
2011-08-08  6:45 ` [PATCH 2/2] xfs: fix splice/direct-IO deadlock Dave Chinner
2011-08-08  6:45   ` Dave Chinner
2011-08-10 10:17   ` Christoph Hellwig
2011-08-10 10:17     ` Christoph Hellwig
2011-08-10 10:19 ` [PATCH 0/2] splice: i_mutex vs splice write deadlock V2 Christoph Hellwig
2011-08-10 10:19   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2012-11-28  2:12 [PATCH 0/2] splice: fix direct IO/splice deadlock Dave Chinner
2012-11-28  2:12 ` [PATCH 2/2] xfs: fix splice/direct-IO deadlock Dave Chinner
2012-11-28  2:12   ` Dave Chinner
2012-11-28 16:07   ` Christoph Hellwig
2012-11-28 16:07     ` Christoph Hellwig
2012-11-28 21:33     ` Dave Chinner
2012-11-28 21:33       ` Dave Chinner
2011-07-18  4:04 [PATCH 0/2] splice: i_mutex vs splice write deadlock Dave Chinner
2011-07-18  4:04 ` [PATCH 2/2] xfs: fix splice/direct-IO deadlock Dave Chinner
2011-07-18  4:04   ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.