Skip to content

Commit

Permalink
ksmbd: uninterruptible wait for a file being unlocked
Browse files Browse the repository at this point in the history
the wait can be canceled by SMB2_CANCEL, SMB2_CLOSE,
SMB2_LOGOFF, disconnection or shutdown, we don't have
to use wait_event_interruptible.

And this remove the warning from Coverity:

CID 1502834 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from ksmbd_vfs_posix_lock_wait(flock)
to err here, but that stored value is overwritten before it can be used.

Signed-off-by: Hyunchul Lee <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
hclee authored and namjaejeon committed Jul 10, 2021
1 parent d63528e commit 45a64e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fs/ksmbd/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -6799,7 +6799,7 @@ int smb2_lock(struct ksmbd_work *work)

smb2_send_interim_resp(work, STATUS_PENDING);

err = ksmbd_vfs_posix_lock_wait(flock);
ksmbd_vfs_posix_lock_wait(flock);

if (work->state != KSMBD_WORK_ACTIVE) {
list_del(&smb_lock->llist);
Expand Down
4 changes: 2 additions & 2 deletions fs/ksmbd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1784,9 +1784,9 @@ int ksmbd_vfs_copy_file_ranges(struct ksmbd_work *work,
return 0;
}

int ksmbd_vfs_posix_lock_wait(struct file_lock *flock)
void ksmbd_vfs_posix_lock_wait(struct file_lock *flock)
{
return wait_event_interruptible(flock->fl_wait, !flock->fl_blocker);
wait_event(flock->fl_wait, !flock->fl_blocker);
}

int ksmbd_vfs_posix_lock_wait_timeout(struct file_lock *flock, long timeout)
Expand Down
2 changes: 1 addition & 1 deletion fs/ksmbd/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
struct user_namespace *user_ns,
struct dentry *dentry,
struct ksmbd_kstat *ksmbd_kstat);
int ksmbd_vfs_posix_lock_wait(struct file_lock *flock);
void ksmbd_vfs_posix_lock_wait(struct file_lock *flock);
int ksmbd_vfs_posix_lock_wait_timeout(struct file_lock *flock, long timeout);
void ksmbd_vfs_posix_lock_unblock(struct file_lock *flock);
int ksmbd_vfs_remove_acl_xattrs(struct user_namespace *user_ns,
Expand Down

0 comments on commit 45a64e8

Please sign in to comment.