Commit 7ecbe926 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

ksmbd: use F_SETLK when unlocking a file

ksmbd seems to be trying to use a cmd value of 0 when unlocking a file.
That activity requires a type of F_UNLCK with a cmd of F_SETLK. For
local POSIX locking, it doesn't matter much since vfs_lock_file ignores
@cmd, but filesystems that define their own ->lock operation expect to
see it set sanely.

Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 37ba7b00
...@@ -6753,7 +6753,7 @@ static int smb2_set_flock_flags(struct file_lock *flock, int flags) ...@@ -6753,7 +6753,7 @@ static int smb2_set_flock_flags(struct file_lock *flock, int flags)
case SMB2_LOCKFLAG_UNLOCK: case SMB2_LOCKFLAG_UNLOCK:
ksmbd_debug(SMB, "received unlock request\n"); ksmbd_debug(SMB, "received unlock request\n");
flock->fl_type = F_UNLCK; flock->fl_type = F_UNLCK;
cmd = 0; cmd = F_SETLK;
break; break;
} }
...@@ -7131,7 +7131,7 @@ int smb2_lock(struct ksmbd_work *work) ...@@ -7131,7 +7131,7 @@ int smb2_lock(struct ksmbd_work *work)
rlock->fl_start = smb_lock->start; rlock->fl_start = smb_lock->start;
rlock->fl_end = smb_lock->end; rlock->fl_end = smb_lock->end;
rc = vfs_lock_file(filp, 0, rlock, NULL); rc = vfs_lock_file(filp, F_SETLK, rlock, NULL);
if (rc) if (rc)
pr_err("rollback unlock fail : %d\n", rc); pr_err("rollback unlock fail : %d\n", rc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment