Skip to content

Commit

Permalink
[CIFS] Fix losing locks during fork()
Browse files Browse the repository at this point in the history
When process does fork() private_data of files with lock list stays the same
for file descriptors of the parent and of the child. While finishing the child closes
files and deletes locks from the list even if unlocking fails. When the child process
finishes the parent doesn't have lock in lock list and can't unlock previously before
fork() locked region after the child process finished.

This patch provides behaviour to save locks in lock list if unlocking fails.

Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Pavel Shilovsky authored and Steve French committed Apr 21, 2010
1 parent f19159d commit 2c964d1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,9 +922,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
1, 0, li->type, false);
if (stored_rc)
rc = stored_rc;

list_del(&li->llist);
kfree(li);
else {
list_del(&li->llist);
kfree(li);
}
}
}
mutex_unlock(&fid->lock_mutex);
Expand Down

0 comments on commit 2c964d1

Please sign in to comment.