aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/file.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index d9cc07fec99f..cf0b1539b321 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -645,20 +645,20 @@ int cifs_closedir(struct inode *inode, struct file *file)
645} 645}
646 646
647static struct cifsLockInfo * 647static struct cifsLockInfo *
648cifs_lock_init(__u64 len, __u64 offset, __u8 type, __u16 netfid) 648cifs_lock_init(__u64 offset, __u64 length, __u8 type, __u16 netfid)
649{ 649{
650 struct cifsLockInfo *li = 650 struct cifsLockInfo *lock =
651 kmalloc(sizeof(struct cifsLockInfo), GFP_KERNEL); 651 kmalloc(sizeof(struct cifsLockInfo), GFP_KERNEL);
652 if (!li) 652 if (!lock)
653 return li; 653 return lock;
654 li->netfid = netfid; 654 lock->offset = offset;
655 li->offset = offset; 655 lock->length = length;
656 li->length = len; 656 lock->type = type;
657 li->type = type; 657 lock->netfid = netfid;
658 li->pid = current->tgid; 658 lock->pid = current->tgid;
659 INIT_LIST_HEAD(&li->blist); 659 INIT_LIST_HEAD(&lock->blist);
660 init_waitqueue_head(&li->block_q); 660 init_waitqueue_head(&lock->block_q);
661 return li; 661 return lock;
662} 662}
663 663
664static void 664static void
@@ -770,10 +770,8 @@ try_again:
770 (lock->blist.next == &lock->blist)); 770 (lock->blist.next == &lock->blist));
771 if (!rc) 771 if (!rc)
772 goto try_again; 772 goto try_again;
773 else { 773 mutex_lock(&cinode->lock_mutex);
774 mutex_lock(&cinode->lock_mutex); 774 list_del_init(&lock->blist);
775 list_del_init(&lock->blist);
776 }
777 } 775 }
778 776
779 mutex_unlock(&cinode->lock_mutex); 777 mutex_unlock(&cinode->lock_mutex);
@@ -927,7 +925,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
927 else 925 else
928 type = CIFS_WRLCK; 926 type = CIFS_WRLCK;
929 927
930 lck = cifs_lock_init(length, flock->fl_start, type, 928 lck = cifs_lock_init(flock->fl_start, length, type,
931 cfile->netfid); 929 cfile->netfid);
932 if (!lck) { 930 if (!lck) {
933 rc = -ENOMEM; 931 rc = -ENOMEM;
@@ -1064,14 +1062,12 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u8 type,
1064 if (rc != 0) 1062 if (rc != 0)
1065 cERROR(1, "Error unlocking previously locked " 1063 cERROR(1, "Error unlocking previously locked "
1066 "range %d during test of lock", rc); 1064 "range %d during test of lock", rc);
1067 rc = 0; 1065 return 0;
1068 return rc;
1069 } 1066 }
1070 1067
1071 if (type & LOCKING_ANDX_SHARED_LOCK) { 1068 if (type & LOCKING_ANDX_SHARED_LOCK) {
1072 flock->fl_type = F_WRLCK; 1069 flock->fl_type = F_WRLCK;
1073 rc = 0; 1070 return 0;
1074 return rc;
1075 } 1071 }
1076 1072
1077 rc = CIFSSMBLock(xid, tcon, netfid, current->tgid, length, 1073 rc = CIFSSMBLock(xid, tcon, netfid, current->tgid, length,
@@ -1089,8 +1085,7 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u8 type,
1089 } else 1085 } else
1090 flock->fl_type = F_WRLCK; 1086 flock->fl_type = F_WRLCK;
1091 1087
1092 rc = 0; 1088 return 0;
1093 return rc;
1094} 1089}
1095 1090
1096static void 1091static void
@@ -1250,7 +1245,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u8 type,
1250 if (lock) { 1245 if (lock) {
1251 struct cifsLockInfo *lock; 1246 struct cifsLockInfo *lock;
1252 1247
1253 lock = cifs_lock_init(length, flock->fl_start, type, netfid); 1248 lock = cifs_lock_init(flock->fl_start, length, type, netfid);
1254 if (!lock) 1249 if (!lock)
1255 return -ENOMEM; 1250 return -ENOMEM;
1256 1251