|
@@ -2037,7 +2037,7 @@ xfs_idestroy_fork(
|
|
|
* once someone is waiting for it to be unpinned.
|
|
|
*/
|
|
|
static void
|
|
|
-xfs_iunpin_nowait(
|
|
|
+xfs_iunpin(
|
|
|
struct xfs_inode *ip)
|
|
|
{
|
|
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
|
|
@@ -2049,14 +2049,29 @@ xfs_iunpin_nowait(
|
|
|
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+__xfs_iunpin_wait(
|
|
|
+ struct xfs_inode *ip)
|
|
|
+{
|
|
|
+ wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IPINNED_BIT);
|
|
|
+ DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IPINNED_BIT);
|
|
|
+
|
|
|
+ xfs_iunpin(ip);
|
|
|
+
|
|
|
+ do {
|
|
|
+ prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
|
|
|
+ if (xfs_ipincount(ip))
|
|
|
+ io_schedule();
|
|
|
+ } while (xfs_ipincount(ip));
|
|
|
+ finish_wait(wq, &wait.wait);
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
xfs_iunpin_wait(
|
|
|
struct xfs_inode *ip)
|
|
|
{
|
|
|
- if (xfs_ipincount(ip)) {
|
|
|
- xfs_iunpin_nowait(ip);
|
|
|
- wait_event(ip->i_ipin_wait, (xfs_ipincount(ip) == 0));
|
|
|
- }
|
|
|
+ if (xfs_ipincount(ip))
|
|
|
+ __xfs_iunpin_wait(ip);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -2415,7 +2430,7 @@ xfs_iflush(
|
|
|
* out for us if they occur after the log force completes.
|
|
|
*/
|
|
|
if (!(flags & SYNC_WAIT) && xfs_ipincount(ip)) {
|
|
|
- xfs_iunpin_nowait(ip);
|
|
|
+ xfs_iunpin(ip);
|
|
|
xfs_ifunlock(ip);
|
|
|
return EAGAIN;
|
|
|
}
|