Skip to content

Commit 7ecbe92

Browse files
jtlaytonsmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: David Howells <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 37ba7b0 commit 7ecbe92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6753,7 +6753,7 @@ static int smb2_set_flock_flags(struct file_lock *flock, int flags)
67536753
case SMB2_LOCKFLAG_UNLOCK:
67546754
ksmbd_debug(SMB, "received unlock request\n");
67556755
flock->fl_type = F_UNLCK;
6756-
cmd = 0;
6756+
cmd = F_SETLK;
67576757
break;
67586758
}
67596759

@@ -7131,7 +7131,7 @@ int smb2_lock(struct ksmbd_work *work)
71317131
rlock->fl_start = smb_lock->start;
71327132
rlock->fl_end = smb_lock->end;
71337133

7134-
rc = vfs_lock_file(filp, 0, rlock, NULL);
7134+
rc = vfs_lock_file(filp, F_SETLK, rlock, NULL);
71357135
if (rc)
71367136
pr_err("rollback unlock fail : %d\n", rc);
71377137

0 commit comments

Comments
 (0)