Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304575
| From | Jeff Layton <jlayton@poochiereds.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/6] locks: don't check for race with close when setting OFD lock |
| Date | 2016-01-08 15:10 +0100 |
| Message-ID | <qOFTR-7OQ-25@gated-at.bofh.it> (permalink) |
| References | <qOuYq-8uq-15@gated-at.bofh.it> <qOFKa-7uJ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We don't clean out OFD locks on close(), so there's no need to check
for a race with them here. They'll get cleaned out at the same time
that flock locks are.
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
---
fs/locks.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index c263aff793bc..e72077d5a664 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2219,10 +2219,12 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
error = do_lock_file_wait(filp, cmd, file_lock);
/*
- * Attempt to detect a close/fcntl race and recover by
- * releasing the lock that was just acquired.
+ * Attempt to detect a close/fcntl race and recover by releasing the
+ * lock that was just acquired. There is no need to do that when we're
+ * unlocking though, or for OFD locks.
*/
- if (!error && file_lock->fl_type != F_UNLCK) {
+ if (!error && file_lock->fl_type != F_UNLCK &&
+ !(file_lock->fl_flags & FL_OFDLCK)) {
/*
* We need that spin_lock here - it prevents reordering between
* update of i_flctx->flc_posix and check for it done in
@@ -2361,10 +2363,12 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
error = do_lock_file_wait(filp, cmd, file_lock);
/*
- * Attempt to detect a close/fcntl race and recover by
- * releasing the lock that was just acquired.
+ * Attempt to detect a close/fcntl race and recover by releasing the
+ * lock that was just acquired. There is no need to do that when we're
+ * unlocking though, or for OFD locks.
*/
- if (!error && file_lock->fl_type != F_UNLCK) {
+ if (!error && file_lock->fl_type != F_UNLCK &&
+ !(file_lock->fl_flags & FL_OFDLCK)) {
/*
* We need that spin_lock here - it prevents reordering between
* update of i_flctx->flc_posix and check for it done in
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] locks: fix unlock when fcntl_setlk races with a close Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 03:30 +0100
Re: [PATCH] locks: fix unlock when fcntl_setlk races with a close Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 13:50 +0100
Re: [PATCH] locks: fix unlock when fcntl_setlk races with a close "J. Bruce Fields" <bfields@fieldses.org> - 2016-01-08 17:20 +0100
[PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
Re: [PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close "J. Bruce Fields" <bfields@fieldses.org> - 2016-01-08 17:00 +0100
Re: [PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 17:20 +0100
Re: [PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close "J. Bruce Fields" <bfields@fieldses.org> - 2016-01-08 17:30 +0100
Re: [PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close "J. Bruce Fields" <bfields@fieldses.org> - 2016-01-08 17:30 +0100
Re: [PATCH v2 1/6] locks: fix unlock when fcntl_setlk races with a close "J. Bruce Fields" <bfields@fieldses.org> - 2016-01-08 17:30 +0100
[PATCH v2 4/6] locks: pass inode pointer to locks_free_lock_context Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
[PATCH v2 0/6] locks: better debugging and fix for setlk/close race handling Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
[PATCH v2 6/6] locks: rename __posix_lock_file to posix_lock_inode Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
[PATCH v2 5/6] locks: prink more detail when there are leaked locks Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
[PATCH v2 3/6] locks: sprinkle some tracepoints around the file locking code Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:00 +0100
[PATCH v2 2/6] locks: don't check for race with close when setting OFD lock Jeff Layton <jlayton@poochiereds.net> - 2016-01-08 15:10 +0100
csiph-web