/* Add a FLOCK style lock to a file.  */
int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
/* Add a FLOCK style lock to a file.  */
int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
{
	int error;
	might_sleep();
	for (;;) {
		error = flock_lock_file(filp, fl);
		if (error != FILE_LOCK_DEFERRED)
			break;
		error = wait_event_interruptible(fl->fl_wait, !fl->fl_next);
		if (!error)
			continue;
		locks_delete_block(fl);
		break;
	}
	return error;
}