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

Commit 4f656367 authored by Benjamin Coddington's avatar Benjamin Coddington Committed by Jeff Layton
Browse files

Move locks API users to locks_lock_inode_wait()



Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
parent e55c34a6
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
			op_data, &lockh, &flock, 0, NULL /* req */, flags);

	if ((file_lock->fl_flags & FL_FLOCK) &&
	    (rc == 0 || file_lock->fl_type == F_UNLCK))
		rc2  = flock_lock_file_wait(file, file_lock);
	if ((file_lock->fl_flags & FL_POSIX) &&
	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
	    !(flags & LDLM_FL_TEST_LOCK))
		rc2  = posix_lock_file_wait(file, file_lock);
		rc2  = locks_lock_file_wait(file, file_lock);

	if (rc2 && file_lock->fl_type != F_UNLCK) {
		einfo.ei_mode = LCK_NL;
+2 −2
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
		BUG();

	res = posix_lock_file_wait(filp, fl);
	res = locks_lock_file_wait(filp, fl);
	if (res < 0)
		goto out;

@@ -231,7 +231,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
	if (res < 0 && fl->fl_type != F_UNLCK) {
		fl_type = fl->fl_type;
		fl->fl_type = F_UNLCK;
		res = posix_lock_file_wait(filp, fl);
		res = locks_lock_file_wait(filp, fl);
		fl->fl_type = fl_type;
	}
out:
+2 −2
Original line number Diff line number Diff line
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
				file, lock_cmd, wait, fl);
	if (!err) {
		err = flock_lock_file_wait(file, fl);
		err = locks_lock_file_wait(file, fl);
		if (err) {
			ceph_lock_message(CEPH_LOCK_FLOCK,
					  CEPH_MDS_OP_SETFILELOCK,
					  file, CEPH_LOCK_UNLOCK, 0, fl);
			dout("got %d on flock_lock_file_wait, undid lock", err);
			dout("got %d on locks_lock_file_wait, undid lock", err);
		}
	}
	return err;
+1 −1
Original line number Diff line number Diff line
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,

out:
	if (flock->fl_flags & FL_POSIX && !rc)
		rc = posix_lock_file_wait(file, flock);
		rc = locks_lock_file_wait(file, flock);
	return rc;
}

+2 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
	rv = op->info.rv;

	if (!rv) {
		if (posix_lock_file_wait(file, fl) < 0)
		if (locks_lock_file_wait(file, fl) < 0)
			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
				  (unsigned long long)number);
	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
	/* cause the vfs unlock to return ENOENT if lock is not found */
	fl->fl_flags |= FL_EXISTS;

	rv = posix_lock_file_wait(file, fl);
	rv = locks_lock_file_wait(file, fl);
	if (rv == -ENOENT) {
		rv = 0;
		goto out_free;
Loading