aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <roland@digitalvampire.org>2007-05-03 00:33:45 -0400
committerSteve French <sfrench@us.ibm.com>2007-05-03 00:33:45 -0400
commit796e5661f6b6be1600b3ab47c61ce61cf3e7a353 (patch)
treea7d4b6df0eef48d1b3a06b11b6705eb597a360b1
parent0b2365f826f40d6e966365299d4e9dcc7ef4e93f (diff)
[CIFS] Change semaphore to mutex for cifs lock_sem
Originally at http://lkml.org/lkml/2006/9/2/86 The recent change to "allow Windows blocking locks to be cancelled via a CANCEL_LOCK call" introduced a new semaphore in struct cifsFileInfo, lock_sem. However, semaphores used as mutexes are deprecated these days, and there's no reason to add a new one to the kernel. Therefore, convert lock_sem to a struct mutex (and also fix one indentation glitch on one of the lines changed anyway). Signed-off-by: Roland Dreier <roland@digitalvampire.org> Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/dir.c2
-rw-r--r--fs/cifs/file.c14
3 files changed, 9 insertions, 9 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index e4de8eba4780..23655de2f4a4 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -311,7 +311,7 @@ struct cifsFileInfo {
311 /* lock scope id (0 if none) */ 311 /* lock scope id (0 if none) */
312 struct file * pfile; /* needed for writepage */ 312 struct file * pfile; /* needed for writepage */
313 struct inode * pInode; /* needed for oplock break */ 313 struct inode * pInode; /* needed for oplock break */
314 struct semaphore lock_sem; 314 struct mutex lock_mutex;
315 struct list_head llist; /* list of byte range locks we have. */ 315 struct list_head llist; /* list of byte range locks we have. */
316 unsigned closePend:1; /* file is marked to close */ 316 unsigned closePend:1; /* file is marked to close */
317 unsigned invalidHandle:1; /* file closed via session abend */ 317 unsigned invalidHandle:1; /* file closed via session abend */
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 3fad638d26d3..e5210519ac4b 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -274,7 +274,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
274 pCifsFile->invalidHandle = FALSE; 274 pCifsFile->invalidHandle = FALSE;
275 pCifsFile->closePend = FALSE; 275 pCifsFile->closePend = FALSE;
276 init_MUTEX(&pCifsFile->fh_sem); 276 init_MUTEX(&pCifsFile->fh_sem);
277 init_MUTEX(&pCifsFile->lock_sem); 277 mutex_init(&pCifsFile->lock_mutex);
278 INIT_LIST_HEAD(&pCifsFile->llist); 278 INIT_LIST_HEAD(&pCifsFile->llist);
279 atomic_set(&pCifsFile->wrtPending,0); 279 atomic_set(&pCifsFile->wrtPending,0);
280 280
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 467cf89c039f..b570530f97bf 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -48,7 +48,7 @@ static inline struct cifsFileInfo *cifs_init_private(
48 private_data->netfid = netfid; 48 private_data->netfid = netfid;
49 private_data->pid = current->tgid; 49 private_data->pid = current->tgid;
50 init_MUTEX(&private_data->fh_sem); 50 init_MUTEX(&private_data->fh_sem);
51 init_MUTEX(&private_data->lock_sem); 51 mutex_init(&private_data->lock_mutex);
52 INIT_LIST_HEAD(&private_data->llist); 52 INIT_LIST_HEAD(&private_data->llist);
53 private_data->pfile = file; /* needed for writepage */ 53 private_data->pfile = file; /* needed for writepage */
54 private_data->pInode = inode; 54 private_data->pInode = inode;
@@ -511,12 +511,12 @@ int cifs_close(struct inode *inode, struct file *file)
511 511
512 /* Delete any outstanding lock records. 512 /* Delete any outstanding lock records.
513 We'll lose them when the file is closed anyway. */ 513 We'll lose them when the file is closed anyway. */
514 down(&pSMBFile->lock_sem); 514 mutex_lock(&pSMBFile->lock_mutex);
515 list_for_each_entry_safe(li, tmp, &pSMBFile->llist, llist) { 515 list_for_each_entry_safe(li, tmp, &pSMBFile->llist, llist) {
516 list_del(&li->llist); 516 list_del(&li->llist);
517 kfree(li); 517 kfree(li);
518 } 518 }
519 up(&pSMBFile->lock_sem); 519 mutex_unlock(&pSMBFile->lock_mutex);
520 520
521 write_lock(&GlobalSMBSeslock); 521 write_lock(&GlobalSMBSeslock);
522 list_del(&pSMBFile->flist); 522 list_del(&pSMBFile->flist);
@@ -601,9 +601,9 @@ static int store_file_lock(struct cifsFileInfo *fid, __u64 len,
601 li->offset = offset; 601 li->offset = offset;
602 li->length = len; 602 li->length = len;
603 li->type = lockType; 603 li->type = lockType;
604 down(&fid->lock_sem); 604 mutex_lock(&fid->lock_mutex);
605 list_add(&li->llist, &fid->llist); 605 list_add(&li->llist, &fid->llist);
606 up(&fid->lock_sem); 606 mutex_unlock(&fid->lock_mutex);
607 return 0; 607 return 0;
608} 608}
609 609
@@ -760,7 +760,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
760 struct cifsLockInfo *li, *tmp; 760 struct cifsLockInfo *li, *tmp;
761 761
762 rc = 0; 762 rc = 0;
763 down(&fid->lock_sem); 763 mutex_lock(&fid->lock_mutex);
764 list_for_each_entry_safe(li, tmp, &fid->llist, llist) { 764 list_for_each_entry_safe(li, tmp, &fid->llist, llist) {
765 if (pfLock->fl_start <= li->offset && 765 if (pfLock->fl_start <= li->offset &&
766 length >= li->length) { 766 length >= li->length) {
@@ -774,7 +774,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
774 kfree(li); 774 kfree(li);
775 } 775 }
776 } 776 }
777 up(&fid->lock_sem); 777 mutex_unlock(&fid->lock_mutex);
778 } 778 }
779 } 779 }
780 780