diff options
author | Jan Blunck <jblunck@infradead.org> | 2010-08-15 16:51:10 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-04 15:10:10 -0400 |
commit | db71922217a214e5c9268448e537b54fc1f301ea (patch) | |
tree | 9c9afbf29411547891f6968e5ade29ce59d66c07 /fs/ecryptfs | |
parent | 899611ee7d373e5eeda08e9a8632684e1ebbbf00 (diff) |
BKL: Explicitly add BKL around get_sb/fill_super
This patch is a preparation necessary to remove the BKL from do_new_mount().
It explicitly adds calls to lock_kernel()/unlock_kernel() around
get_sb/fill_super operations for filesystems that still uses the BKL.
I've read through all the code formerly covered by the BKL inside
do_kern_mount() and have satisfied myself that it doesn't need the BKL
any more.
do_kern_mount() is already called without the BKL when mounting the rootfs
and in nfsctl. do_kern_mount() calls vfs_kern_mount(), which is called
from various places without BKL: simple_pin_fs(), nfs_do_clone_mount()
through nfs_follow_mountpoint(), afs_mntpt_do_automount() through
afs_mntpt_follow_link(). Both later functions are actually the filesystems
follow_link inode operation. vfs_kern_mount() is calling the specified
get_sb function and lets the filesystem do its job by calling the given
fill_super function.
Therefore I think it is safe to push down the BKL from the VFS to the
low-level filesystems get_sb/fill_super operation.
[arnd: do not add the BKL to those file systems that already
don't use it elsewhere]
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r-- | fs/ecryptfs/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index cbd4e18adb20..c4af92fa12c3 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/fs_stack.h> | 37 | #include <linux/fs_stack.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> /* For lock_kernel() */ | ||
39 | #include "ecryptfs_kernel.h" | 40 | #include "ecryptfs_kernel.h" |
40 | 41 | ||
41 | /** | 42 | /** |
@@ -550,6 +551,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | |||
550 | const char *err = "Getting sb failed"; | 551 | const char *err = "Getting sb failed"; |
551 | int rc; | 552 | int rc; |
552 | 553 | ||
554 | lock_kernel(); | ||
553 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); | 555 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); |
554 | if (!sbi) { | 556 | if (!sbi) { |
555 | rc = -ENOMEM; | 557 | rc = -ENOMEM; |
@@ -608,6 +610,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | |||
608 | goto out; | 610 | goto out; |
609 | } | 611 | } |
610 | simple_set_mnt(mnt, s); | 612 | simple_set_mnt(mnt, s); |
613 | unlock_kernel(); | ||
611 | return 0; | 614 | return 0; |
612 | 615 | ||
613 | out: | 616 | out: |
@@ -616,6 +619,7 @@ out: | |||
616 | kmem_cache_free(ecryptfs_sb_info_cache, sbi); | 619 | kmem_cache_free(ecryptfs_sb_info_cache, sbi); |
617 | } | 620 | } |
618 | printk(KERN_ERR "%s; rc = [%d]\n", err, rc); | 621 | printk(KERN_ERR "%s; rc = [%d]\n", err, rc); |
622 | unlock_kernel(); | ||
619 | return rc; | 623 | return rc; |
620 | } | 624 | } |
621 | 625 | ||