From 796e5661f6b6be1600b3ab47c61ce61cf3e7a353 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Thu, 3 May 2007 04:33:45 +0000 Subject: [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 Signed-off-by: Jan Engelhardt Signed-off-by: Steve French --- fs/cifs/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fs/cifs/file.c') diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 467cf89c039..b570530f97b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -48,7 +48,7 @@ static inline struct cifsFileInfo *cifs_init_private( private_data->netfid = netfid; private_data->pid = current->tgid; init_MUTEX(&private_data->fh_sem); - init_MUTEX(&private_data->lock_sem); + mutex_init(&private_data->lock_mutex); INIT_LIST_HEAD(&private_data->llist); private_data->pfile = file; /* needed for writepage */ private_data->pInode = inode; @@ -511,12 +511,12 @@ int cifs_close(struct inode *inode, struct file *file) /* Delete any outstanding lock records. We'll lose them when the file is closed anyway. */ - down(&pSMBFile->lock_sem); + mutex_lock(&pSMBFile->lock_mutex); list_for_each_entry_safe(li, tmp, &pSMBFile->llist, llist) { list_del(&li->llist); kfree(li); } - up(&pSMBFile->lock_sem); + mutex_unlock(&pSMBFile->lock_mutex); write_lock(&GlobalSMBSeslock); list_del(&pSMBFile->flist); @@ -601,9 +601,9 @@ static int store_file_lock(struct cifsFileInfo *fid, __u64 len, li->offset = offset; li->length = len; li->type = lockType; - down(&fid->lock_sem); + mutex_lock(&fid->lock_mutex); list_add(&li->llist, &fid->llist); - up(&fid->lock_sem); + mutex_unlock(&fid->lock_mutex); return 0; } @@ -760,7 +760,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) struct cifsLockInfo *li, *tmp; rc = 0; - down(&fid->lock_sem); + mutex_lock(&fid->lock_mutex); list_for_each_entry_safe(li, tmp, &fid->llist, llist) { if (pfLock->fl_start <= li->offset && length >= li->length) { @@ -774,7 +774,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) kfree(li); } } - up(&fid->lock_sem); + mutex_unlock(&fid->lock_mutex); } } -- cgit v1.2.3