diff options
Diffstat (limited to 'fs/locks.c')
| -rw-r--r-- | fs/locks.c | 11 | 
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/locks.c b/fs/locks.c index 90c8746874de..bdd94c32256f 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1367,9 +1367,9 @@ retry:  		locks_wake_up_blocks(&left->c);  	}   out: +	trace_posix_lock_inode(inode, request, error);  	spin_unlock(&ctx->flc_lock);  	percpu_up_read(&file_rwsem); -	trace_posix_lock_inode(inode, request, error);  	/*  	 * Free any unused locks.  	 */ @@ -2448,8 +2448,9 @@ 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. There is no need to do that when we're +	 * Detect close/fcntl races and recover by zapping all POSIX locks +	 * associated with this file and our files_struct, just like on +	 * filp_flush(). There is no need to do that when we're  	 * unlocking though, or for OFD locks.  	 */  	if (!error && file_lock->c.flc_type != F_UNLCK && @@ -2464,9 +2465,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,  		f = files_lookup_fd_locked(files, fd);  		spin_unlock(&files->file_lock);  		if (f != filp) { -			file_lock->c.flc_type = F_UNLCK; -			error = do_lock_file_wait(filp, cmd, file_lock); -			WARN_ON_ONCE(error); +			locks_remove_posix(filp, files);  			error = -EBADF;  		}  	}  |