aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/locks.c16
1 files 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,
2219 error = do_lock_file_wait(filp, cmd, file_lock); 2219 error = do_lock_file_wait(filp, cmd, file_lock);
2220 2220
2221 /* 2221 /*
2222 * Attempt to detect a close/fcntl race and recover by 2222 * Attempt to detect a close/fcntl race and recover by releasing the
2223 * releasing the lock that was just acquired. 2223 * lock that was just acquired. There is no need to do that when we're
2224 * unlocking though, or for OFD locks.
2224 */ 2225 */
2225 if (!error && file_lock->fl_type != F_UNLCK) { 2226 if (!error && file_lock->fl_type != F_UNLCK &&
2227 !(file_lock->fl_flags & FL_OFDLCK)) {
2226 /* 2228 /*
2227 * We need that spin_lock here - it prevents reordering between 2229 * We need that spin_lock here - it prevents reordering between
2228 * update of i_flctx->flc_posix and check for it done in 2230 * 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,
2361 error = do_lock_file_wait(filp, cmd, file_lock); 2363 error = do_lock_file_wait(filp, cmd, file_lock);
2362 2364
2363 /* 2365 /*
2364 * Attempt to detect a close/fcntl race and recover by 2366 * Attempt to detect a close/fcntl race and recover by releasing the
2365 * releasing the lock that was just acquired. 2367 * lock that was just acquired. There is no need to do that when we're
2368 * unlocking though, or for OFD locks.
2366 */ 2369 */
2367 if (!error && file_lock->fl_type != F_UNLCK) { 2370 if (!error && file_lock->fl_type != F_UNLCK &&
2371 !(file_lock->fl_flags & FL_OFDLCK)) {
2368 /* 2372 /*
2369 * We need that spin_lock here - it prevents reordering between 2373 * We need that spin_lock here - it prevents reordering between
2370 * update of i_flctx->flc_posix and check for it done in 2374 * update of i_flctx->flc_posix and check for it done in