diff options
author | Yoshihisa Abe <yoshiabe@cs.cmu.edu> | 2010-10-25 02:03:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 08:02:40 -0700 |
commit | f7cc02b8715618e179242ba9cc10bdc5146ae565 (patch) | |
tree | 80c1bcf6923c9982a52fbe510cb7d396fb9866fc /fs/coda/inode.c | |
parent | b5ce1d83a62fc109d8e815b1fc71dcdb0d26bc49 (diff) | |
download | linux-f7cc02b8715618e179242ba9cc10bdc5146ae565.tar.bz2 |
Coda: push BKL regions into coda_upcall()
Now that shared inode state is locked using the cii->c_lock, the BKL is
only used to protect the upcall queues used to communicate with the
userspace cache manager. The remaining state is all local and we can
push the lock further down into coda_upcall().
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.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 0553f3bd7b1b..b7fa3e3d772f 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -150,8 +150,6 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) int error; int idx; - lock_kernel(); - idx = get_device_index((struct coda_mount_data *) data); /* Ignore errors in data, for backward compatibility */ @@ -161,23 +159,26 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) printk(KERN_INFO "coda_read_super: device index: %i\n", idx); vc = &coda_comms[idx]; + lock_kernel(); + if (!vc->vc_inuse) { printk("coda_read_super: No pseudo device\n"); - unlock_kernel(); - return -EINVAL; + error = -EINVAL; + goto unlock_out; } - if ( vc->vc_sb ) { + if (vc->vc_sb) { printk("coda_read_super: Device already mounted\n"); - unlock_kernel(); - return -EBUSY; + error = -EBUSY; + goto unlock_out; } error = bdi_setup_and_register(&vc->bdi, "coda", BDI_CAP_MAP_COPY); if (error) - goto bdi_err; + goto unlock_out; vc->vc_sb = sb; + unlock_kernel(); sb->s_fs_info = vc; sb->s_flags |= MS_NOATIME; @@ -206,21 +207,23 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) printk("coda_read_super: rootinode is %ld dev %s\n", root->i_ino, root->i_sb->s_id); sb->s_root = d_alloc_root(root); - if (!sb->s_root) + if (!sb->s_root) { + error = -EINVAL; goto error; - unlock_kernel(); + } return 0; - error: - bdi_destroy(&vc->bdi); - bdi_err: +error: if (root) iput(root); - if (vc) - vc->vc_sb = NULL; + lock_kernel(); + bdi_destroy(&vc->bdi); + vc->vc_sb = NULL; + sb->s_fs_info = NULL; +unlock_out: unlock_kernel(); - return -EINVAL; + return error; } static void coda_put_super(struct super_block *sb) @@ -253,8 +256,6 @@ int coda_setattr(struct dentry *de, struct iattr *iattr) struct coda_vattr vattr; int error; - lock_kernel(); - memset(&vattr, 0, sizeof(vattr)); inode->i_ctime = CURRENT_TIME_SEC; @@ -264,13 +265,10 @@ int coda_setattr(struct dentry *de, struct iattr *iattr) /* Venus is responsible for truncating the container-file!!! */ error = venus_setattr(inode->i_sb, coda_i2f(inode), &vattr); - if ( !error ) { + if (!error) { coda_vattr_to_iattr(inode, &vattr); coda_cache_clear_inode(inode); } - - unlock_kernel(); - return error; } @@ -284,12 +282,8 @@ static int coda_statfs(struct dentry *dentry, struct kstatfs *buf) { int error; - lock_kernel(); - error = venus_statfs(dentry, buf); - unlock_kernel(); - if (error) { /* fake something like AFS does */ buf->f_blocks = 9000000; |