aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c28
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);