diff options
author | Pavel Shilovsky <piastryyy@gmail.com> | 2010-04-05 01:59:14 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-04-06 13:24:26 -0400 |
commit | f05337c6ac48d19d354e0640a8eb8fc884f82bcc (patch) | |
tree | 7be4407febc50dba022112281f1f6d04eb2a5a22 /fs/cifs/file.c | |
parent | 6513a81e9325d712f1bfb9a1d7b750134e49ff18 (diff) |
not overwriting file_lock structure after GET_LK
If we have preventing lock, cifs should overwrite file_lock structure
with info about preventing lock. If we haven't preventing lock, cifs
should leave it unchanged except for the lock type (change it to F_UNLCK).
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ca2ba7a0193c..d9e86504b9d4 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -838,8 +838,32 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
838 | 838 | ||
839 | } else { | 839 | } else { |
840 | /* if rc == ERR_SHARING_VIOLATION ? */ | 840 | /* if rc == ERR_SHARING_VIOLATION ? */ |
841 | rc = 0; /* do not change lock type to unlock | 841 | rc = 0; |
842 | since range in use */ | 842 | |
843 | if (lockType & LOCKING_ANDX_SHARED_LOCK) { | ||
844 | pfLock->fl_type = F_WRLCK; | ||
845 | } else { | ||
846 | rc = CIFSSMBLock(xid, tcon, netfid, length, | ||
847 | pfLock->fl_start, 0, 1, | ||
848 | lockType | LOCKING_ANDX_SHARED_LOCK, | ||
849 | 0 /* wait flag */); | ||
850 | if (rc == 0) { | ||
851 | rc = CIFSSMBLock(xid, tcon, netfid, | ||
852 | length, pfLock->fl_start, 1, 0, | ||
853 | lockType | | ||
854 | LOCKING_ANDX_SHARED_LOCK, | ||
855 | 0 /* wait flag */); | ||
856 | pfLock->fl_type = F_RDLCK; | ||
857 | if (rc != 0) | ||
858 | cERROR(1, ("Error unlocking " | ||
859 | "previously locked range %d " | ||
860 | "during test of lock", rc)); | ||
861 | rc = 0; | ||
862 | } else { | ||
863 | pfLock->fl_type = F_WRLCK; | ||
864 | rc = 0; | ||
865 | } | ||
866 | } | ||
843 | } | 867 | } |
844 | 868 | ||
845 | FreeXid(xid); | 869 | FreeXid(xid); |