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

Commit 9ec3c882 authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Steve French
Browse files

CIFS: Separate pushing posix locks and lock_sem handling

parent 6d3ea7e4
Loading
Loading
Loading
Loading
+19 −13
Original line number Original line Diff line number Diff line
@@ -1041,9 +1041,8 @@ struct lock_to_push {
};
};


static int
static int
cifs_push_posix_locks(struct cifsFileInfo *cfile)
cifs_push_posix_locks_locked(struct cifsFileInfo *cfile)
{
{
	struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
	struct file_lock *flock, **before;
	struct file_lock *flock, **before;
	unsigned int count = 0, i = 0;
	unsigned int count = 0, i = 0;
@@ -1054,14 +1053,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)


	xid = get_xid();
	xid = get_xid();


	/* we are going to update can_cache_brlcks here - need a write access */
	down_write(&cinode->lock_sem);
	if (!cinode->can_cache_brlcks) {
		up_write(&cinode->lock_sem);
		free_xid(xid);
		return rc;
	}

	lock_flocks();
	lock_flocks();
	cifs_for_each_lock(cfile->dentry->d_inode, before) {
	cifs_for_each_lock(cfile->dentry->d_inode, before) {
		if ((*before)->fl_flags & FL_POSIX)
		if ((*before)->fl_flags & FL_POSIX)
@@ -1127,9 +1118,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
	}
	}


out:
out:
	cinode->can_cache_brlcks = false;
	up_write(&cinode->lock_sem);

	free_xid(xid);
	free_xid(xid);
	return rc;
	return rc;
err_out:
err_out:
@@ -1140,6 +1128,24 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
	goto out;
	goto out;
}
}


static int
cifs_push_posix_locks(struct cifsFileInfo *cfile)
{
	struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
	int rc = 0;

	/* we are going to update can_cache_brlcks here - need a write access */
	down_write(&cinode->lock_sem);
	if (!cinode->can_cache_brlcks) {
		up_write(&cinode->lock_sem);
		return rc;
	}
	rc = cifs_push_posix_locks_locked(cfile);
	cinode->can_cache_brlcks = false;
	up_write(&cinode->lock_sem);
	return rc;
}

static int
static int
cifs_push_locks(struct cifsFileInfo *cfile)
cifs_push_locks(struct cifsFileInfo *cfile)
{
{