Merge branch 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Oct 2010 17:52:01 +0000 (10:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Oct 2010 17:52:01 +0000 (10:52 -0700)
* '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
  ...

1  2 
fs/affs/super.c
fs/ext3/super.c
fs/ext4/super.c
fs/gfs2/file.c
fs/ocfs2/super.c
include/linux/fs.h
kernel/cgroup.c

diff --combined fs/affs/super.c
@@@ -16,7 -16,6 +16,6 @@@
  #include <linux/parser.h>
  #include <linux/magic.h>
  #include <linux/sched.h>
- #include <linux/smp_lock.h>
  #include <linux/slab.h>
  #include "affs.h"
  
@@@ -46,8 -45,6 +45,6 @@@ affs_put_super(struct super_block *sb
        struct affs_sb_info *sbi = AFFS_SB(sb);
        pr_debug("AFFS: put_super()\n");
  
-       lock_kernel();
        if (!(sb->s_flags & MS_RDONLY) && sb->s_dirt)
                affs_commit_super(sb, 1, 1);
  
@@@ -56,8 -53,6 +53,6 @@@
        affs_brelse(sbi->s_root_bh);
        kfree(sbi);
        sb->s_fs_info = NULL;
-       unlock_kernel();
  }
  
  static void
@@@ -109,8 -104,8 +104,8 @@@ static void init_once(void *foo
  {
        struct affs_inode_info *ei = (struct affs_inode_info *) foo;
  
 -      init_MUTEX(&ei->i_link_lock);
 -      init_MUTEX(&ei->i_ext_lock);
 +      sema_init(&ei->i_link_lock, 1);
 +      sema_init(&ei->i_ext_lock, 1);
        inode_init_once(&ei->vfs_inode);
  }
  
@@@ -302,6 -297,7 +297,7 @@@ static int affs_fill_super(struct super
        sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
        mutex_init(&sbi->s_bmlock);
        spin_lock_init(&sbi->symlink_lock);
@@@ -527,7 -523,7 +523,7 @@@ affs_remount(struct super_block *sb, in
                kfree(new_opts);
                return -EINVAL;
        }
-       lock_kernel();
        replace_mount_options(sb, new_opts);
  
        sbi->s_flags = mount_flags;
        memcpy(sbi->s_volume, volume, 32);
        spin_unlock(&sbi->symlink_lock);
  
-       if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
-               unlock_kernel();
+       if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
                return 0;
-       }
        if (*flags & MS_RDONLY) {
                affs_write_super(sb);
                affs_free_bitmap(sb);
        } else
                res = affs_init_bitmap(sb, flags);
  
-       unlock_kernel();
        return res;
  }
  
diff --combined fs/ext3/super.c
@@@ -411,9 -411,6 +411,6 @@@ static void ext3_put_super (struct supe
        int i, err;
  
        dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
-       lock_kernel();
        ext3_xattr_put_super(sb);
        err = journal_destroy(sbi->s_journal);
        sbi->s_journal = NULL;
        sb->s_fs_info = NULL;
        kfree(sbi->s_blockgroup_lock);
        kfree(sbi);
-       unlock_kernel();
  }
  
  static struct kmem_cache *ext3_inode_cachep;
@@@ -1627,8 -1622,6 +1622,6 @@@ static int ext3_fill_super (struct supe
        sbi->s_resgid = EXT3_DEF_RESGID;
        sbi->s_sb_block = sb_block;
  
-       unlock_kernel();
        blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
        if (!blocksize) {
                ext3_msg(sb, KERN_ERR, "error: unable to set blocksize");
                goto failed_mount;
        }
  
 -      if (le32_to_cpu(es->s_blocks_count) >
 -                  (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {
 +      if (generic_check_addressable(sb->s_blocksize_bits,
 +                                    le32_to_cpu(es->s_blocks_count))) {
                ext3_msg(sb, KERN_ERR,
                        "error: filesystem is too large to mount safely");
                if (sizeof(sector_t) < 8)
                test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
                "writeback");
  
-       lock_kernel();
        return 0;
  
  cantfind_ext3:
@@@ -2055,7 -2047,6 +2047,6 @@@ out_fail
        sb->s_fs_info = NULL;
        kfree(sbi->s_blockgroup_lock);
        kfree(sbi);
-       lock_kernel();
        return ret;
  }
  
@@@ -2538,8 -2529,6 +2529,6 @@@ static int ext3_remount (struct super_b
        int i;
  #endif
  
-       lock_kernel();
        /* Store the original options */
        lock_super(sb);
        old_sb_flags = sb->s_flags;
                        kfree(old_opts.s_qf_names[i]);
  #endif
        unlock_super(sb);
-       unlock_kernel();
  
        if (enable_quota)
                dquot_resume(sb, -1);
@@@ -2669,7 -2657,6 +2657,6 @@@ restore_opts
        }
  #endif
        unlock_super(sb);
-       unlock_kernel();
        return err;
  }
  
diff --combined fs/ext4/super.c
@@@ -26,7 -26,6 +26,6 @@@
  #include <linux/init.h>
  #include <linux/blkdev.h>
  #include <linux/parser.h>
- #include <linux/smp_lock.h>
  #include <linux/buffer_head.h>
  #include <linux/exportfs.h>
  #include <linux/vfs.h>
@@@ -708,7 -707,6 +707,6 @@@ static void ext4_put_super(struct super
        destroy_workqueue(sbi->dio_unwritten_wq);
  
        lock_super(sb);
-       lock_kernel();
        if (sb->s_dirt)
                ext4_commit_super(sb, 1);
  
         * Now that we are completely done shutting down the
         * superblock, we need to actually destroy the kobject.
         */
-       unlock_kernel();
        unlock_super(sb);
        kobject_put(&sbi->s_kobj);
        wait_for_completion(&sbi->s_kobj_unregister);
@@@ -2588,8 -2585,6 +2585,6 @@@ static int ext4_fill_super(struct super
                sbi->s_sectors_written_start =
                        part_stat_read(sb->s_bdev->bd_part, sectors[1]);
  
-       unlock_kernel();
        /* Cleanup superblock name */
        for (cp = sb->s_id; (cp = strchr(cp, '/'));)
                *cp = '!';
         * Test whether we have more sectors than will fit in sector_t,
         * and whether the max offset is addressable by the page cache.
         */
 -      if ((ext4_blocks_count(es) >
 -           (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) ||
 -          (ext4_blocks_count(es) >
 -           (pgoff_t)(~0ULL) >> (PAGE_CACHE_SHIFT - sb->s_blocksize_bits))) {
 +      ret = generic_check_addressable(sb->s_blocksize_bits,
 +                                      ext4_blocks_count(es));
 +      if (ret) {
                ext4_msg(sb, KERN_ERR, "filesystem"
                         " too large to mount safely on this system");
                if (sizeof(sector_t) < 8)
                        ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled");
 -              ret = -EFBIG;
                goto failed_mount;
        }
  
@@@ -3164,7 -3161,6 +3159,6 @@@ no_journal
        if (es->s_error_count)
                mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */
  
-       lock_kernel();
        kfree(orig_data);
        return 0;
  
@@@ -3211,7 -3207,6 +3205,6 @@@ out_fail
        sb->s_fs_info = NULL;
        kfree(sbi->s_blockgroup_lock);
        kfree(sbi);
-       lock_kernel();
  out_free_orig:
        kfree(orig_data);
        return ret;
@@@ -3720,8 -3715,6 +3713,6 @@@ static int ext4_remount(struct super_bl
  #endif
        char *orig_data = kstrdup(data, GFP_KERNEL);
  
-       lock_kernel();
        /* Store the original options */
        lock_super(sb);
        old_sb_flags = sb->s_flags;
                        kfree(old_opts.s_qf_names[i]);
  #endif
        unlock_super(sb);
-       unlock_kernel();
        if (enable_quota)
                dquot_resume(sb, -1);
  
@@@ -3882,7 -3874,6 +3872,6 @@@ restore_opts
        }
  #endif
        unlock_super(sb);
-       unlock_kernel();
        kfree(orig_data);
        return err;
  }
diff --combined fs/gfs2/file.c
@@@ -382,10 -382,8 +382,10 @@@ static int gfs2_page_mkwrite(struct vm_
        rblocks = RES_DINODE + ind_blocks;
        if (gfs2_is_jdata(ip))
                rblocks += data_blocks ? data_blocks : 1;
 -      if (ind_blocks || data_blocks)
 +      if (ind_blocks || data_blocks) {
                rblocks += RES_STATFS + RES_QUOTA;
 +              rblocks += gfs2_rg_blocks(al);
 +      }
        ret = gfs2_trans_begin(sdp, rblocks, 0);
        if (ret)
                goto out_trans_fail;
@@@ -493,7 -491,7 +493,7 @@@ static int gfs2_open(struct inode *inod
                        goto fail;
  
                if (!(file->f_flags & O_LARGEFILE) &&
 -                  ip->i_disksize > MAX_NON_LFS) {
 +                  i_size_read(inode) > MAX_NON_LFS) {
                        error = -EOVERFLOW;
                        goto fail_gunlock;
                }
@@@ -622,6 -620,8 +622,8 @@@ static ssize_t gfs2_file_aio_write(stru
   * cluster; until we do, disable leases (by just returning -EINVAL),
   * unless the administrator has requested purely local locking.
   *
+  * Locking: called under lock_flocks
+  *
   * Returns: errno
   */
  
diff --combined fs/ocfs2/super.c
@@@ -162,7 -162,6 +162,7 @@@ enum 
        Opt_nointr,
        Opt_hb_none,
        Opt_hb_local,
 +      Opt_hb_global,
        Opt_data_ordered,
        Opt_data_writeback,
        Opt_atime_quantum,
        Opt_noacl,
        Opt_usrquota,
        Opt_grpquota,
 +      Opt_coherency_buffered,
 +      Opt_coherency_full,
        Opt_resv_level,
        Opt_dir_resv_level,
        Opt_err,
@@@ -193,7 -190,6 +193,7 @@@ static const match_table_t tokens = 
        {Opt_nointr, "nointr"},
        {Opt_hb_none, OCFS2_HB_NONE},
        {Opt_hb_local, OCFS2_HB_LOCAL},
 +      {Opt_hb_global, OCFS2_HB_GLOBAL},
        {Opt_data_ordered, "data=ordered"},
        {Opt_data_writeback, "data=writeback"},
        {Opt_atime_quantum, "atime_quantum=%u"},
        {Opt_noacl, "noacl"},
        {Opt_usrquota, "usrquota"},
        {Opt_grpquota, "grpquota"},
 +      {Opt_coherency_buffered, "coherency=buffered"},
 +      {Opt_coherency_full, "coherency=full"},
        {Opt_resv_level, "resv_level=%u"},
        {Opt_dir_resv_level, "dir_resv_level=%u"},
        {Opt_err, NULL}
@@@ -520,11 -514,11 +520,11 @@@ static void ocfs2_release_system_inodes
  
        mlog_entry_void();
  
 -      for (i = 0; i < NUM_SYSTEM_INODES; i++) {
 -              inode = osb->system_inodes[i];
 +      for (i = 0; i < NUM_GLOBAL_SYSTEM_INODES; i++) {
 +              inode = osb->global_system_inodes[i];
                if (inode) {
                        iput(inode);
 -                      osb->system_inodes[i] = NULL;
 +                      osb->global_system_inodes[i] = NULL;
                }
        }
  
                osb->root_inode = NULL;
        }
  
 +      if (!osb->local_system_inodes)
 +              goto out;
 +
 +      for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) {
 +              if (osb->local_system_inodes[i]) {
 +                      iput(osb->local_system_inodes[i]);
 +                      osb->local_system_inodes[i] = NULL;
 +              }
 +      }
 +
 +      kfree(osb->local_system_inodes);
 +      osb->local_system_inodes = NULL;
 +
 +out:
        mlog_exit(0);
  }
  
@@@ -628,19 -608,15 +628,17 @@@ static int ocfs2_remount(struct super_b
        int ret = 0;
        struct mount_options parsed_options;
        struct ocfs2_super *osb = OCFS2_SB(sb);
 +      u32 tmp;
  
-       lock_kernel();
        if (!ocfs2_parse_options(sb, data, &parsed_options, 1) ||
            !ocfs2_check_set_options(sb, &parsed_options)) {
                ret = -EINVAL;
                goto out;
        }
  
 -      if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
 -          (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
 +      tmp = OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
 +              OCFS2_MOUNT_HB_NONE;
 +      if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) {
                ret = -EINVAL;
                mlog(ML_ERROR, "Cannot change heartbeat mode on remount\n");
                goto out;
@@@ -739,7 -715,6 +737,6 @@@ unlock_osb
                                                        MS_POSIXACL : 0);
        }
  out:
-       unlock_kernel();
        return ret;
  }
  
@@@ -831,29 -806,23 +828,29 @@@ bail
  
  static int ocfs2_verify_heartbeat(struct ocfs2_super *osb)
  {
 -      if (ocfs2_mount_local(osb)) {
 -              if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
 +      u32 hb_enabled = OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL;
 +
 +      if (osb->s_mount_opt & hb_enabled) {
 +              if (ocfs2_mount_local(osb)) {
                        mlog(ML_ERROR, "Cannot heartbeat on a locally "
                             "mounted device.\n");
                        return -EINVAL;
                }
 -      }
 -
 -      if (ocfs2_userspace_stack(osb)) {
 -              if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) {
 +              if (ocfs2_userspace_stack(osb)) {
                        mlog(ML_ERROR, "Userspace stack expected, but "
                             "o2cb heartbeat arguments passed to mount\n");
                        return -EINVAL;
                }
 +              if (((osb->s_mount_opt & OCFS2_MOUNT_HB_GLOBAL) &&
 +                   !ocfs2_cluster_o2cb_global_heartbeat(osb)) ||
 +                  ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) &&
 +                   ocfs2_cluster_o2cb_global_heartbeat(osb))) {
 +                      mlog(ML_ERROR, "Mismatching o2cb heartbeat modes\n");
 +                      return -EINVAL;
 +              }
        }
  
 -      if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
 +      if (!(osb->s_mount_opt & hb_enabled)) {
                if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb) &&
                    !ocfs2_userspace_stack(osb)) {
                        mlog(ML_ERROR, "Heartbeat has to be started to mount "
@@@ -1319,7 -1288,6 +1316,7 @@@ static int ocfs2_parse_options(struct s
  {
        int status;
        char *p;
 +      u32 tmp;
  
        mlog_entry("remount: %d, options: \"%s\"\n", is_remount,
                   options ? options : "(none)");
                        mopt->mount_opt |= OCFS2_MOUNT_HB_LOCAL;
                        break;
                case Opt_hb_none:
 -                      mopt->mount_opt &= ~OCFS2_MOUNT_HB_LOCAL;
 +                      mopt->mount_opt |= OCFS2_MOUNT_HB_NONE;
 +                      break;
 +              case Opt_hb_global:
 +                      mopt->mount_opt |= OCFS2_MOUNT_HB_GLOBAL;
                        break;
                case Opt_barrier:
                        if (match_int(&args[0], &option)) {
                case Opt_grpquota:
                        mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA;
                        break;
 +              case Opt_coherency_buffered:
 +                      mopt->mount_opt |= OCFS2_MOUNT_COHERENCY_BUFFERED;
 +                      break;
 +              case Opt_coherency_full:
 +                      mopt->mount_opt &= ~OCFS2_MOUNT_COHERENCY_BUFFERED;
 +                      break;
                case Opt_acl:
                        mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
                        mopt->mount_opt &= ~OCFS2_MOUNT_NO_POSIX_ACL;
                }
        }
  
 +      /* Ensure only one heartbeat mode */
 +      tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
 +                               OCFS2_MOUNT_HB_NONE);
 +      if (hweight32(tmp) != 1) {
 +              mlog(ML_ERROR, "Invalid heartbeat mount options\n");
 +              status = 0;
 +              goto bail;
 +      }
 +
        status = 1;
  
  bail:
@@@ -1537,14 -1487,10 +1534,14 @@@ static int ocfs2_show_options(struct se
        unsigned long opts = osb->s_mount_opt;
        unsigned int local_alloc_megs;
  
 -      if (opts & OCFS2_MOUNT_HB_LOCAL)
 -              seq_printf(s, ",_netdev,heartbeat=local");
 -      else
 -              seq_printf(s, ",heartbeat=none");
 +      if (opts & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL)) {
 +              seq_printf(s, ",_netdev");
 +              if (opts & OCFS2_MOUNT_HB_LOCAL)
 +                      seq_printf(s, ",%s", OCFS2_HB_LOCAL);
 +              else
 +                      seq_printf(s, ",%s", OCFS2_HB_GLOBAL);
 +      } else
 +              seq_printf(s, ",%s", OCFS2_HB_NONE);
  
        if (opts & OCFS2_MOUNT_NOINTR)
                seq_printf(s, ",nointr");
        if (opts & OCFS2_MOUNT_GRPQUOTA)
                seq_printf(s, ",grpquota");
  
 +      if (opts & OCFS2_MOUNT_COHERENCY_BUFFERED)
 +              seq_printf(s, ",coherency=buffered");
 +      else
 +              seq_printf(s, ",coherency=full");
 +
        if (opts & OCFS2_MOUNT_NOUSERXATTR)
                seq_printf(s, ",nouser_xattr");
        else
@@@ -1696,13 -1637,9 +1693,9 @@@ static void ocfs2_put_super(struct supe
  {
        mlog_entry("(0x%p)\n", sb);
  
-       lock_kernel();
        ocfs2_sync_blockdev(sb);
        ocfs2_dismount_volume(sb, 0);
  
-       unlock_kernel();
        mlog_exit_void();
  }
  
@@@ -2046,36 -1983,6 +2039,36 @@@ static int ocfs2_setup_osb_uuid(struct 
        return 0;
  }
  
 +/* Make sure entire volume is addressable by our journal.  Requires
 +   osb_clusters_at_boot to be valid and for the journal to have been
 +   initialized by ocfs2_journal_init(). */
 +static int ocfs2_journal_addressable(struct ocfs2_super *osb)
 +{
 +      int status = 0;
 +      u64 max_block =
 +              ocfs2_clusters_to_blocks(osb->sb,
 +                                       osb->osb_clusters_at_boot) - 1;
 +
 +      /* 32-bit block number is always OK. */
 +      if (max_block <= (u32)~0ULL)
 +              goto out;
 +
 +      /* Volume is "huge", so see if our journal is new enough to
 +         support it. */
 +      if (!(OCFS2_HAS_COMPAT_FEATURE(osb->sb,
 +                                     OCFS2_FEATURE_COMPAT_JBD2_SB) &&
 +            jbd2_journal_check_used_features(osb->journal->j_journal, 0, 0,
 +                                             JBD2_FEATURE_INCOMPAT_64BIT))) {
 +              mlog(ML_ERROR, "The journal cannot address the entire volume. "
 +                   "Enable the 'block64' journal option with tunefs.ocfs2");
 +              status = -EFBIG;
 +              goto out;
 +      }
 +
 + out:
 +      return status;
 +}
 +
  static int ocfs2_initialize_super(struct super_block *sb,
                                  struct buffer_head *bh,
                                  int sector_size,
        struct ocfs2_journal *journal;
        __le32 uuid_net_key;
        struct ocfs2_super *osb;
 +      u64 total_blocks;
  
        mlog_entry_void();
  
        snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
                 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
  
 +      osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
 +      if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
 +              mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
 +                   osb->max_slots);
 +              status = -EINVAL;
 +              goto bail;
 +      }
 +      mlog(0, "max_slots for this device: %u\n", osb->max_slots);
 +
        ocfs2_orphan_scan_init(osb);
  
        status = ocfs2_recovery_init(osb);
                goto bail;
        }
  
 -      osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
 -      if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
 -              mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
 -                   osb->max_slots);
 -              status = -EINVAL;
 -              goto bail;
 -      }
 -      mlog(0, "max_slots for this device: %u\n", osb->max_slots);
 -
        osb->slot_recovery_generations =
                kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
                        GFP_KERNEL);
                goto bail;
        }
  
 -      if (ocfs2_userspace_stack(osb)) {
 +      if (ocfs2_clusterinfo_valid(osb)) {
 +              osb->osb_stackflags =
 +                      OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags;
                memcpy(osb->osb_cluster_stack,
                       OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
                       OCFS2_STACK_LABEL_LEN);
                goto bail;
        }
  
 -      if (ocfs2_clusters_to_blocks(osb->sb, le32_to_cpu(di->i_clusters) - 1)
 -          > (u32)~0UL) {
 -              mlog(ML_ERROR, "Volume might try to write to blocks beyond "
 -                   "what jbd can address in 32 bits.\n");
 -              status = -EINVAL;
 +      total_blocks = ocfs2_clusters_to_blocks(osb->sb,
 +                                              le32_to_cpu(di->i_clusters));
 +
 +      status = generic_check_addressable(osb->sb->s_blocksize_bits,
 +                                         total_blocks);
 +      if (status) {
 +              mlog(ML_ERROR, "Volume too large "
 +                   "to mount safely on this system");
 +              status = -EFBIG;
                goto bail;
        }
  
@@@ -2473,12 -2373,6 +2466,12 @@@ static int ocfs2_check_volume(struct oc
                goto finally;
        }
  
 +      /* Now that journal has been initialized, check to make sure
 +         entire volume is addressable. */
 +      status = ocfs2_journal_addressable(osb);
 +      if (status)
 +              goto finally;
 +
        /* If the journal was unmounted cleanly then we don't want to
         * recover anything. Otherwise, journal_load will do that
         * dirty work for us :) */
diff --combined include/linux/fs.h
@@@ -1093,10 -1093,6 +1093,6 @@@ struct file_lock 
  
  #include <linux/fcntl.h>
  
- /* temporary stubs for BKL removal */
- #define lock_flocks() lock_kernel()
- #define unlock_flocks() unlock_kernel()
  extern void send_sigio(struct fown_struct *fown, int fd, int band);
  
  #ifdef CONFIG_FILE_LOCKING
@@@ -1135,6 -1131,8 +1131,8 @@@ extern int vfs_setlease(struct file *, 
  extern int lease_modify(struct file_lock **, int);
  extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
  extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
+ extern void lock_flocks(void);
+ extern void unlock_flocks(void);
  #else /* !CONFIG_FILE_LOCKING */
  static inline int fcntl_getlk(struct file *file, struct flock __user *user)
  {
@@@ -1277,6 -1275,14 +1275,14 @@@ static inline int lock_may_write(struc
        return 1;
  }
  
+ static inline void lock_flocks(void)
+ {
+ }
+ static inline void unlock_flocks(void)
+ {
+ }
  #endif /* !CONFIG_FILE_LOCKING */
  
  
@@@ -1384,7 -1390,7 +1390,7 @@@ struct super_block 
         * Saved mount options for lazy filesystems using
         * generic_show_options()
         */
 -      char *s_options;
 +      char __rcu *s_options;
  };
  
  extern struct timespec current_fs_time(struct super_block *sb);
@@@ -2378,8 -2384,6 +2384,8 @@@ extern ssize_t simple_write_to_buffer(v
  
  extern int generic_file_fsync(struct file *, int);
  
 +extern int generic_check_addressable(unsigned, u64);
 +
  #ifdef CONFIG_MIGRATION
  extern int buffer_migrate_page(struct address_space *,
                                struct page *, struct page *);
diff --combined kernel/cgroup.c
@@@ -52,7 -52,6 +52,6 @@@
  #include <linux/cgroupstats.h>
  #include <linux/hash.h>
  #include <linux/namei.h>
- #include <linux/smp_lock.h>
  #include <linux/pid_namespace.h>
  #include <linux/idr.h>
  #include <linux/vmalloc.h> /* TODO: replace with more sophisticated array */
@@@ -138,7 -137,7 +137,7 @@@ struct css_id 
         * is called after synchronize_rcu(). But for safe use, css_is_removed()
         * css_tryget() should be used for avoiding race.
         */
 -      struct cgroup_subsys_state *css;
 +      struct cgroup_subsys_state __rcu *css;
        /*
         * ID of this css.
         */
@@@ -1222,7 -1221,6 +1221,6 @@@ static int cgroup_remount(struct super_
        struct cgroup *cgrp = &root->top_cgroup;
        struct cgroup_sb_opts opts;
  
-       lock_kernel();
        mutex_lock(&cgrp->dentry->d_inode->i_mutex);
        mutex_lock(&cgroup_mutex);
  
        kfree(opts.name);
        mutex_unlock(&cgroup_mutex);
        mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
-       unlock_kernel();
        return ret;
  }
  
@@@ -1568,7 -1565,6 +1565,6 @@@ static int cgroup_get_sb(struct file_sy
   out_err:
        kfree(opts.release_agent);
        kfree(opts.name);
        return ret;
  }