[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <154198528917.14364.12807627735259492190.stgit@noble>
Date: Mon, 12 Nov 2018 12:14:49 +1100
From: NeilBrown <neilb@...e.com>
To: Jeff Layton <jlayton@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@...ldses.org>,
Martin Wilck <mwilck@...e.de>, linux-fsdevel@...r.kernel.org,
Frank Filz <ffilzlnx@...dspring.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 08/12] fs/locks: always delete_block after waiting.
Now that requests can block other requests, we
need to be careful to always clean up those blocked
requests.
Any time that we wait for a request, we might have
other requests attached, and when we stop waiting,
we must clean them up.
If the lock was granted, the requests might have been
moved to the new lock, though when merged with a
pre-exiting lock, this might not happen.
In all cases we don't want blocked locks to remain
attached, so we remove them to be safe.
Signed-off-by: NeilBrown <neilb@...e.com>
---
fs/locks.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index c1b79293007b..8d9d79e7a565 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1272,12 +1272,10 @@ static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
if (error != FILE_LOCK_DEFERRED)
break;
error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
- if (!error)
- continue;
-
- locks_delete_block(fl);
- break;
+ if (error)
+ break;
}
+ locks_delete_block(fl);
return error;
}
@@ -1966,12 +1964,10 @@ static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
if (error != FILE_LOCK_DEFERRED)
break;
error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
- if (!error)
- continue;
-
- locks_delete_block(fl);
- break;
+ if (error)
+ break;
}
+ locks_delete_block(fl);
return error;
}
@@ -2245,12 +2241,10 @@ static int do_lock_file_wait(struct file *filp, unsigned int cmd,
if (error != FILE_LOCK_DEFERRED)
break;
error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
- if (!error)
- continue;
-
- locks_delete_block(fl);
- break;
+ if (error)
+ break;
}
+ locks_delete_block(fl);
return error;
}
Powered by blists - more mailing lists