diff options
author | Pavel Shilovsky <piastryyy@gmail.com> | 2010-04-21 15:44:24 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-04-21 15:44:24 -0400 |
commit | 2c964d1f7c87eb71f7902111cd7c8fbba225e4b6 (patch) | |
tree | 926ea339b7731049c363411bfc87094566488f43 | |
parent | f19159dc5ab9ec28c3b8230689101335d98e2d68 (diff) |
[CIFS] Fix losing locks during fork()
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>
-rw-r--r-- | fs/cifs/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 99897e3562a7..2ba4c41be972 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -922,9 +922,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
922 | 1, 0, li->type, false); | 922 | 1, 0, li->type, false); |
923 | if (stored_rc) | 923 | if (stored_rc) |
924 | rc = stored_rc; | 924 | rc = stored_rc; |
925 | 925 | else { | |
926 | list_del(&li->llist); | 926 | list_del(&li->llist); |
927 | kfree(li); | 927 | kfree(li); |
928 | } | ||
928 | } | 929 | } |
929 | } | 930 | } |
930 | mutex_unlock(&fid->lock_mutex); | 931 | mutex_unlock(&fid->lock_mutex); |