ksmbd: don't increment epoch if current state and request state are same
[ Upstream commit b6e9a44e99603fe10e1d78901fdd97681a539612 ] If existing lease state and request state are same, don't increment epoch in create context. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e61fc656ce
commit
de603a52af
@ -105,7 +105,7 @@ static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
|
|||||||
lease->is_dir = lctx->is_dir;
|
lease->is_dir = lctx->is_dir;
|
||||||
memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
|
memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
|
||||||
lease->version = lctx->version;
|
lease->version = lctx->version;
|
||||||
lease->epoch = le16_to_cpu(lctx->epoch);
|
lease->epoch = le16_to_cpu(lctx->epoch) + 1;
|
||||||
INIT_LIST_HEAD(&opinfo->lease_entry);
|
INIT_LIST_HEAD(&opinfo->lease_entry);
|
||||||
opinfo->o_lease = lease;
|
opinfo->o_lease = lease;
|
||||||
|
|
||||||
@ -541,6 +541,9 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lctx->req_state != lease->state)
|
||||||
|
lease->epoch++;
|
||||||
|
|
||||||
/* upgrading lease */
|
/* upgrading lease */
|
||||||
if ((atomic_read(&ci->op_count) +
|
if ((atomic_read(&ci->op_count) +
|
||||||
atomic_read(&ci->sop_count)) == 1) {
|
atomic_read(&ci->sop_count)) == 1) {
|
||||||
@ -1035,7 +1038,7 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2)
|
|||||||
SMB2_LEASE_KEY_SIZE);
|
SMB2_LEASE_KEY_SIZE);
|
||||||
lease2->duration = lease1->duration;
|
lease2->duration = lease1->duration;
|
||||||
lease2->flags = lease1->flags;
|
lease2->flags = lease1->flags;
|
||||||
lease2->epoch = lease1->epoch++;
|
lease2->epoch = lease1->epoch;
|
||||||
lease2->version = lease1->version;
|
lease2->version = lease1->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1454,7 +1457,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
|
|||||||
memcpy(buf->lcontext.LeaseKey, lease->lease_key,
|
memcpy(buf->lcontext.LeaseKey, lease->lease_key,
|
||||||
SMB2_LEASE_KEY_SIZE);
|
SMB2_LEASE_KEY_SIZE);
|
||||||
buf->lcontext.LeaseFlags = lease->flags;
|
buf->lcontext.LeaseFlags = lease->flags;
|
||||||
buf->lcontext.Epoch = cpu_to_le16(++lease->epoch);
|
buf->lcontext.Epoch = cpu_to_le16(lease->epoch);
|
||||||
buf->lcontext.LeaseState = lease->state;
|
buf->lcontext.LeaseState = lease->state;
|
||||||
memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key,
|
memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key,
|
||||||
SMB2_LEASE_KEY_SIZE);
|
SMB2_LEASE_KEY_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user