aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/inode.c
diff options
context:
space:
mode:
authorYoshihisa Abe <yoshiabe@cs.cmu.edu>2010-10-25 02:03:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:02:40 -0400
commitda47c19e5c746829042933c8f945a71e2b62d6fc (patch)
tree54110db260f57c01745e1ace343ec72b7eec6c69 /fs/coda/inode.c
parentf7cc02b8715618e179242ba9cc10bdc5146ae565 (diff)
Coda: replace BKL with mutex
Replace the BKL with a mutex to protect the venus_comm structure which binds the mountpoint with the character device and holds the upcall queues. Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu> Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coda/inode.c')
-rw-r--r--fs/coda/inode.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index b7fa3e3d772f..7993b96ca348 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -15,7 +15,7 @@
15#include <linux/stat.h> 15#include <linux/stat.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/unistd.h> 17#include <linux/unistd.h>
18#include <linux/smp_lock.h> 18#include <linux/mutex.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/file.h> 20#include <linux/file.h>
21#include <linux/vfs.h> 21#include <linux/vfs.h>
@@ -145,7 +145,7 @@ static int get_device_index(struct coda_mount_data *data)
145static int coda_fill_super(struct super_block *sb, void *data, int silent) 145static int coda_fill_super(struct super_block *sb, void *data, int silent)
146{ 146{
147 struct inode *root = NULL; 147 struct inode *root = NULL;
148 struct venus_comm *vc = NULL; 148 struct venus_comm *vc;
149 struct CodaFid fid; 149 struct CodaFid fid;
150 int error; 150 int error;
151 int idx; 151 int idx;
@@ -159,7 +159,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
159 printk(KERN_INFO "coda_read_super: device index: %i\n", idx); 159 printk(KERN_INFO "coda_read_super: device index: %i\n", idx);
160 160
161 vc = &coda_comms[idx]; 161 vc = &coda_comms[idx];
162 lock_kernel(); 162 mutex_lock(&vc->vc_mutex);
163 163
164 if (!vc->vc_inuse) { 164 if (!vc->vc_inuse) {
165 printk("coda_read_super: No pseudo device\n"); 165 printk("coda_read_super: No pseudo device\n");
@@ -178,7 +178,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
178 goto unlock_out; 178 goto unlock_out;
179 179
180 vc->vc_sb = sb; 180 vc->vc_sb = sb;
181 unlock_kernel(); 181 mutex_unlock(&vc->vc_mutex);
182 182
183 sb->s_fs_info = vc; 183 sb->s_fs_info = vc;
184 sb->s_flags |= MS_NOATIME; 184 sb->s_flags |= MS_NOATIME;
@@ -217,20 +217,23 @@ error:
217 if (root) 217 if (root)
218 iput(root); 218 iput(root);
219 219
220 lock_kernel(); 220 mutex_lock(&vc->vc_mutex);
221 bdi_destroy(&vc->bdi); 221 bdi_destroy(&vc->bdi);
222 vc->vc_sb = NULL; 222 vc->vc_sb = NULL;
223 sb->s_fs_info = NULL; 223 sb->s_fs_info = NULL;
224unlock_out: 224unlock_out:
225 unlock_kernel(); 225 mutex_unlock(&vc->vc_mutex);
226 return error; 226 return error;
227} 227}
228 228
229static void coda_put_super(struct super_block *sb) 229static void coda_put_super(struct super_block *sb)
230{ 230{
231 bdi_destroy(&coda_vcp(sb)->bdi); 231 struct venus_comm *vcp = coda_vcp(sb);
232 coda_vcp(sb)->vc_sb = NULL; 232 mutex_lock(&vcp->vc_mutex);
233 bdi_destroy(&vcp->bdi);
234 vcp->vc_sb = NULL;
233 sb->s_fs_info = NULL; 235 sb->s_fs_info = NULL;
236 mutex_unlock(&vcp->vc_mutex);
234 237
235 printk("Coda: Bye bye.\n"); 238 printk("Coda: Bye bye.\n");
236} 239}