* [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext
@ 2010-07-27 5:47 Dave Chinner
2010-07-27 7:53 ` Christoph Hellwig
2010-07-27 22:17 ` Alex Elder
0 siblings, 2 replies; 3+ messages in thread
From: Dave Chinner @ 2010-07-27 5:47 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
Otherwise it'll deadlock during allocation/block mapping.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_dfrag.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 3b9582c..f04a79a 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -229,29 +229,34 @@ xfs_swap_extents(
* below.
*/
xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
+
+ /*
+ * can't hold the ILOCK while flushing pages, so flush now we won't get
+ * new pages cached as we hold the XFS_IOLOCK_EXCL.
+ */
+ if (VN_CACHED(VFS_I(tip)) != 0) {
+ error = xfs_flushinval_pages(tip, 0, -1,
+ FI_REMAPF_LOCKED);
+ if (error)
+ goto out_unlock;
+ }
+
xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
- /* Verify that both files have the same format */
- if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
+ /* Verify we have no cached pages for ftmp */
+ if (VN_CACHED(VFS_I(tip)) != 0) {
error = XFS_ERROR(EINVAL);
goto out_unlock;
}
- /* Verify both files are either real-time or non-realtime */
- if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
+ /* Verify that both files have the same format */
+ if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
error = XFS_ERROR(EINVAL);
goto out_unlock;
}
- if (VN_CACHED(VFS_I(tip)) != 0) {
- error = xfs_flushinval_pages(tip, 0, -1,
- FI_REMAPF_LOCKED);
- if (error)
- goto out_unlock;
- }
-
- /* Verify O_DIRECT for ftmp */
- if (VN_CACHED(VFS_I(tip)) != 0) {
+ /* Verify both files are either real-time or non-realtime */
+ if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
error = XFS_ERROR(EINVAL);
goto out_unlock;
}
--
1.7.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext
2010-07-27 5:47 [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext Dave Chinner
@ 2010-07-27 7:53 ` Christoph Hellwig
2010-07-27 22:17 ` Alex Elder
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-07-27 7:53 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Tue, Jul 27, 2010 at 03:47:31PM +1000, Dave Chinner wrote:
> +
> + /*
> + * can't hold the ILOCK while flushing pages, so flush now we won't get
> + * new pages cached as we hold the XFS_IOLOCK_EXCL.
> + */
> + if (VN_CACHED(VFS_I(tip)) != 0) {
There's really no point in the VN_CACHED check here. Not only does
xfs_flushinval_pages repeat it at the beginning, but it's also
rather superflous as filemap_write_and_wait deals with the condition
of no attached pages efficiently.
Otherwise looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext
2010-07-27 5:47 [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext Dave Chinner
2010-07-27 7:53 ` Christoph Hellwig
@ 2010-07-27 22:17 ` Alex Elder
1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2010-07-27 22:17 UTC (permalink / raw)
To: Dave Chinner; +Cc: XFS Mailing List
On Tue, 2010-07-27 at 15:47 +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Otherwise it'll deadlock during allocation/block mapping.
Is this the cause of the xfs_fsr hangs?
Looks good, anyway.
Reviewed-by: Alex Elder <aelder@sgi.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-27 22:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 5:47 [PATCH] xfs: don't hold the XFS_ILOCK while flushing pages in swapext Dave Chinner
2010-07-27 7:53 ` Christoph Hellwig
2010-07-27 22:17 ` Alex Elder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox