Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f07f18dd authored by Trond Myklebust's avatar Trond Myklebust
Browse files

VFS: Add support for the FL_ACCESS flag to flock_lock_file()

parent 42a2d13e
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -739,6 +739,8 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
	int found = 0;
	int found = 0;


	lock_kernel();
	lock_kernel();
	if (request->fl_flags & FL_ACCESS)
		goto find_conflict;
	for_each_lock(inode, before) {
	for_each_lock(inode, before) {
		struct file_lock *fl = *before;
		struct file_lock *fl = *before;
		if (IS_POSIX(fl))
		if (IS_POSIX(fl))
@@ -771,6 +773,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
	if (found)
	if (found)
		cond_resched();
		cond_resched();


find_conflict:
	for_each_lock(inode, before) {
	for_each_lock(inode, before) {
		struct file_lock *fl = *before;
		struct file_lock *fl = *before;
		if (IS_POSIX(fl))
		if (IS_POSIX(fl))
@@ -784,6 +787,8 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
			locks_insert_block(fl, request);
			locks_insert_block(fl, request);
		goto out;
		goto out;
	}
	}
	if (request->fl_flags & FL_ACCESS)
		goto out;
	locks_copy_lock(new_fl, request);
	locks_copy_lock(new_fl, request);
	locks_insert_lock(&inode->i_flock, new_fl);
	locks_insert_lock(&inode->i_flock, new_fl);
	new_fl = NULL;
	new_fl = NULL;