Skip to content

Commit 79f14b7

Browse files
committed
Merge branch 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
* 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: (30 commits) BKL: remove BKL from freevxfs BKL: remove BKL from qnx4 autofs4: Only declare function when CONFIG_COMPAT is defined autofs: Only declare function when CONFIG_COMPAT is defined ncpfs: Lock socket in ncpfs while setting its callbacks fs/locks.c: prepare for BKL removal BKL: Remove BKL from ncpfs BKL: Remove BKL from OCFS2 BKL: Remove BKL from squashfs BKL: Remove BKL from jffs2 BKL: Remove BKL from ecryptfs BKL: Remove BKL from afs BKL: Remove BKL from USB gadgetfs BKL: Remove BKL from autofs4 BKL: Remove BKL from isofs BKL: Remove BKL from fat BKL: Remove BKL from ext2 filesystem BKL: Remove BKL from do_new_mount() BKL: Remove BKL from cgroup BKL: Remove BKL from NTFS ...
2 parents c37927d + 6d7bccc commit 79f14b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+691
-711
lines changed

drivers/usb/gadget/inode.c

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <linux/sched.h>
3434
#include <linux/slab.h>
3535
#include <linux/poll.h>
36-
#include <linux/smp_lock.h>
3736

3837
#include <linux/device.h>
3938
#include <linux/moduleparam.h>

fs/adfs/super.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
352352
struct adfs_sb_info *asb;
353353
struct inode *root;
354354

355+
lock_kernel();
356+
355357
sb->s_flags |= MS_NODIRATIME;
356358

357359
asb = kzalloc(sizeof(*asb), GFP_KERNEL);
358-
if (!asb)
360+
if (!asb) {
361+
unlock_kernel();
359362
return -ENOMEM;
363+
}
360364
sb->s_fs_info = asb;
361365

362366
/* set default options */
@@ -474,13 +478,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
474478
goto error;
475479
} else
476480
sb->s_root->d_op = &adfs_dentry_operations;
481+
unlock_kernel();
477482
return 0;
478483

479484
error_free_bh:
480485
brelse(bh);
481486
error:
482487
sb->s_fs_info = NULL;
483488
kfree(asb);
489+
unlock_kernel();
484490
return -EINVAL;
485491
}
486492

fs/affs/super.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/parser.h>
1717
#include <linux/magic.h>
1818
#include <linux/sched.h>
19-
#include <linux/smp_lock.h>
2019
#include <linux/slab.h>
2120
#include "affs.h"
2221

@@ -46,8 +45,6 @@ affs_put_super(struct super_block *sb)
4645
struct affs_sb_info *sbi = AFFS_SB(sb);
4746
pr_debug("AFFS: put_super()\n");
4847

49-
lock_kernel();
50-
5148
if (!(sb->s_flags & MS_RDONLY) && sb->s_dirt)
5249
affs_commit_super(sb, 1, 1);
5350

@@ -56,8 +53,6 @@ affs_put_super(struct super_block *sb)
5653
affs_brelse(sbi->s_root_bh);
5754
kfree(sbi);
5855
sb->s_fs_info = NULL;
59-
60-
unlock_kernel();
6156
}
6257

6358
static void
@@ -302,6 +297,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
302297
sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
303298
if (!sbi)
304299
return -ENOMEM;
300+
305301
sb->s_fs_info = sbi;
306302
mutex_init(&sbi->s_bmlock);
307303
spin_lock_init(&sbi->symlink_lock);
@@ -527,7 +523,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
527523
kfree(new_opts);
528524
return -EINVAL;
529525
}
530-
lock_kernel();
526+
531527
replace_mount_options(sb, new_opts);
532528

533529
sbi->s_flags = mount_flags;
@@ -543,17 +539,15 @@ affs_remount(struct super_block *sb, int *flags, char *data)
543539
memcpy(sbi->s_volume, volume, 32);
544540
spin_unlock(&sbi->symlink_lock);
545541

546-
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
547-
unlock_kernel();
542+
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
548543
return 0;
549-
}
544+
550545
if (*flags & MS_RDONLY) {
551546
affs_write_super(sb);
552547
affs_free_bitmap(sb);
553548
} else
554549
res = affs_init_bitmap(sb, flags);
555550

556-
unlock_kernel();
557551
return res;
558552
}
559553

fs/afs/flock.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* 2 of the License, or (at your option) any later version.
1010
*/
1111

12-
#include <linux/smp_lock.h>
1312
#include "internal.h"
1413

1514
#define AFS_LOCK_GRANTED 0
@@ -274,7 +273,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
274273

275274
type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
276275

277-
lock_kernel();
276+
lock_flocks();
278277

279278
/* make sure we've got a callback on this file and that our view of the
280279
* data version is up to date */
@@ -421,7 +420,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
421420
afs_vnode_fetch_status(vnode, NULL, key);
422421

423422
error:
424-
unlock_kernel();
423+
unlock_flocks();
425424
_leave(" = %d", ret);
426425
return ret;
427426

fs/afs/super.c

-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/mount.h>
2020
#include <linux/init.h>
2121
#include <linux/slab.h>
22-
#include <linux/smp_lock.h>
2322
#include <linux/fs.h>
2423
#include <linux/pagemap.h>
2524
#include <linux/parser.h>
@@ -453,12 +452,8 @@ static void afs_put_super(struct super_block *sb)
453452

454453
_enter("");
455454

456-
lock_kernel();
457-
458455
afs_put_volume(as->volume);
459456

460-
unlock_kernel();
461-
462457
_leave("");
463458
}
464459

fs/autofs/root.c

+2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ static int autofs_root_unlink(struct inode *,struct dentry *);
2727
static int autofs_root_rmdir(struct inode *,struct dentry *);
2828
static int autofs_root_mkdir(struct inode *,struct dentry *,int);
2929
static long autofs_root_ioctl(struct file *,unsigned int,unsigned long);
30+
#ifdef CONFIG_COMPAT
3031
static long autofs_root_compat_ioctl(struct file *,unsigned int,unsigned long);
32+
#endif
3133

3234
const struct file_operations autofs_root_operations = {
3335
.llseek = generic_file_llseek,

fs/autofs4/root.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/param.h>
2020
#include <linux/time.h>
2121
#include <linux/compat.h>
22-
#include <linux/smp_lock.h>
22+
#include <linux/mutex.h>
2323

2424
#include "autofs_i.h"
2525

@@ -28,7 +28,9 @@ static int autofs4_dir_unlink(struct inode *,struct dentry *);
2828
static int autofs4_dir_rmdir(struct inode *,struct dentry *);
2929
static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
3030
static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
31+
#ifdef CONFIG_COMPAT
3132
static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long);
33+
#endif
3234
static int autofs4_dir_open(struct inode *inode, struct file *file);
3335
static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
3436
static void *autofs4_follow_link(struct dentry *, struct nameidata *);
@@ -978,15 +980,17 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
978980
}
979981
}
980982

983+
static DEFINE_MUTEX(autofs4_ioctl_mutex);
984+
981985
static long autofs4_root_ioctl(struct file *filp,
982986
unsigned int cmd, unsigned long arg)
983987
{
984988
long ret;
985989
struct inode *inode = filp->f_dentry->d_inode;
986990

987-
lock_kernel();
991+
mutex_lock(&autofs4_ioctl_mutex);
988992
ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
989-
unlock_kernel();
993+
mutex_unlock(&autofs4_ioctl_mutex);
990994

991995
return ret;
992996
}
@@ -998,13 +1002,13 @@ static long autofs4_root_compat_ioctl(struct file *filp,
9981002
struct inode *inode = filp->f_path.dentry->d_inode;
9991003
int ret;
10001004

1001-
lock_kernel();
1005+
mutex_lock(&autofs4_ioctl_mutex);
10021006
if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
10031007
ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
10041008
else
10051009
ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
10061010
(unsigned long)compat_ptr(arg));
1007-
unlock_kernel();
1011+
mutex_unlock(&autofs4_ioctl_mutex);
10081012

10091013
return ret;
10101014
}

fs/bfs/inode.c

-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/slab.h>
1313
#include <linux/init.h>
1414
#include <linux/fs.h>
15-
#include <linux/smp_lock.h>
1615
#include <linux/buffer_head.h>
1716
#include <linux/vfs.h>
1817
#include <linux/writeback.h>
@@ -215,14 +214,10 @@ static void bfs_put_super(struct super_block *s)
215214
if (!info)
216215
return;
217216

218-
lock_kernel();
219-
220217
mutex_destroy(&info->bfs_lock);
221218
kfree(info->si_imap);
222219
kfree(info);
223220
s->s_fs_info = NULL;
224-
225-
unlock_kernel();
226221
}
227222

228223
static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)

fs/cifs/cifsfs.c

+5-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <linux/delay.h>
3636
#include <linux/kthread.h>
3737
#include <linux/freezer.h>
38-
#include <linux/smp_lock.h>
3938
#include "cifsfs.h"
4039
#include "cifspdu.h"
4140
#define DECLARE_GLOBALS_HERE
@@ -200,8 +199,6 @@ cifs_put_super(struct super_block *sb)
200199
return;
201200
}
202201

203-
lock_kernel();
204-
205202
rc = cifs_umount(sb, cifs_sb);
206203
if (rc)
207204
cERROR(1, "cifs_umount failed with return code %d", rc);
@@ -215,8 +212,6 @@ cifs_put_super(struct super_block *sb)
215212
unload_nls(cifs_sb->local_nls);
216213
bdi_destroy(&cifs_sb->bdi);
217214
kfree(cifs_sb);
218-
219-
unlock_kernel();
220215
}
221216

222217
static int
@@ -514,7 +509,9 @@ cifs_get_sb(struct file_system_type *fs_type,
514509
int flags, const char *dev_name, void *data, struct vfsmount *mnt)
515510
{
516511
int rc;
517-
struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL);
512+
struct super_block *sb;
513+
514+
sb = sget(fs_type, NULL, set_anon_super, NULL);
518515

519516
cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
520517

@@ -565,8 +562,8 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
565562

566563
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
567564
{
568-
/* note that this is called by vfs setlease with the BKL held
569-
although I doubt that BKL is needed here in cifs */
565+
/* note that this is called by vfs setlease with lock_flocks held
566+
to protect *lease from going away */
570567
struct inode *inode = file->f_path.dentry->d_inode;
571568

572569
if (!(S_ISREG(inode->i_mode)))

fs/coda/inode.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
148148
int error;
149149
int idx;
150150

151+
lock_kernel();
152+
151153
idx = get_device_index((struct coda_mount_data *) data);
152154

153155
/* Ignore errors in data, for backward compatibility */
@@ -159,11 +161,13 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
159161
vc = &coda_comms[idx];
160162
if (!vc->vc_inuse) {
161163
printk("coda_read_super: No pseudo device\n");
164+
unlock_kernel();
162165
return -EINVAL;
163166
}
164167

165168
if ( vc->vc_sb ) {
166169
printk("coda_read_super: Device already mounted\n");
170+
unlock_kernel();
167171
return -EBUSY;
168172
}
169173

@@ -202,7 +206,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
202206
sb->s_root = d_alloc_root(root);
203207
if (!sb->s_root)
204208
goto error;
205-
return 0;
209+
unlock_kernel();
210+
return 0;
206211

207212
error:
208213
bdi_destroy(&vc->bdi);
@@ -212,6 +217,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
212217
if (vc)
213218
vc->vc_sb = NULL;
214219

220+
unlock_kernel();
215221
return -EINVAL;
216222
}
217223

fs/ecryptfs/file.c

-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <linux/security.h>
3232
#include <linux/compat.h>
3333
#include <linux/fs_stack.h>
34-
#include <linux/smp_lock.h>
3534
#include "ecryptfs_kernel.h"
3635

3736
/**
@@ -284,11 +283,9 @@ static int ecryptfs_fasync(int fd, struct file *file, int flag)
284283
int rc = 0;
285284
struct file *lower_file = NULL;
286285

287-
lock_kernel();
288286
lower_file = ecryptfs_file_to_lower(file);
289287
if (lower_file->f_op && lower_file->f_op->fasync)
290288
rc = lower_file->f_op->fasync(fd, lower_file, flag);
291-
unlock_kernel();
292289
return rc;
293290
}
294291

fs/ext2/super.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -747,15 +747,16 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
747747
__le32 features;
748748
int err;
749749

750+
err = -ENOMEM;
750751
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
751752
if (!sbi)
752-
return -ENOMEM;
753+
goto failed_unlock;
753754

754755
sbi->s_blockgroup_lock =
755756
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
756757
if (!sbi->s_blockgroup_lock) {
757758
kfree(sbi);
758-
return -ENOMEM;
759+
goto failed_unlock;
759760
}
760761
sb->s_fs_info = sbi;
761762
sbi->s_sb_block = sb_block;
@@ -1107,6 +1108,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
11071108
sb->s_fs_info = NULL;
11081109
kfree(sbi->s_blockgroup_lock);
11091110
kfree(sbi);
1111+
failed_unlock:
11101112
return ret;
11111113
}
11121114

0 commit comments

Comments
 (0)