Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Wed, 1 Aug 2012 17:26:23 +0000 (10:26 -0700)]
Pull second vfs pile from Al Viro:
 "The stuff in there: fsfreeze deadlock fixes by Jan (essentially, the
  deadlock reproduced by xfstests 068), symlink and hardlink restriction
  patches, plus assorted cleanups and fixes.

  Note that another fsfreeze deadlock (emergency thaw one) is *not*
  dealt with - the series by Fernando conflicts a lot with Jan's, breaks
  userland ABI (FIFREEZE semantics gets changed) and trades the deadlock
  for massive vfsmount leak; this is going to be handled next cycle.
  There probably will be another pull request, but that stuff won't be
  in it."

Fix up trivial conflicts due to unrelated changes next to each other in
drivers/{staging/gdm72xx/usb_boot.c, usb/gadget/storage_common.c}

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (54 commits)
  delousing target_core_file a bit
  Documentation: Correct s_umount state for freeze_fs/unfreeze_fs
  fs: Remove old freezing mechanism
  ext2: Implement freezing
  btrfs: Convert to new freezing mechanism
  nilfs2: Convert to new freezing mechanism
  ntfs: Convert to new freezing mechanism
  fuse: Convert to new freezing mechanism
  gfs2: Convert to new freezing mechanism
  ocfs2: Convert to new freezing mechanism
  xfs: Convert to new freezing code
  ext4: Convert to new freezing mechanism
  fs: Protect write paths by sb_start_write - sb_end_write
  fs: Skip atime update on frozen filesystem
  fs: Add freezing handling to mnt_want_write() / mnt_drop_write()
  fs: Improve filesystem freezing handling
  switch the protection of percpu_counter list to spinlock
  nfsd: Push mnt_want_write() outside of i_mutex
  btrfs: Push mnt_want_write() outside of i_mutex
  fat: Push mnt_want_write() outside of i_mutex
  ...

39 files changed:
1  2 
Documentation/filesystems/Locking
Documentation/sysctl/fs.txt
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
drivers/staging/bcm/Misc.c
drivers/staging/gdm72xx/sdio_boot.c
drivers/staging/gdm72xx/usb_boot.c
drivers/target/target_core_file.c
drivers/usb/gadget/storage_common.c
fs/btrfs/disk-io.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/transaction.c
fs/exec.c
fs/ext2/super.c
fs/ext4/inode.c
fs/ext4/super.c
fs/gfs2/file.c
fs/inode.c
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c
fs/nfsd/vfs.c
fs/nilfs2/ioctl.c
fs/pipe.c
fs/super.c
fs/xfs/xfs_aops.c
fs/xfs/xfs_file.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_sync.c
fs/xfs/xfs_trans.h
include/linux/fs.h
include/linux/mm.h
include/linux/pipe_fs_i.h
kernel/audit.c
kernel/sysctl.c
mm/memory.c
net/unix/af_unix.c

Simple merge
Simple merge
@@@ -155,14 -155,9 +155,9 @@@ static int create_worker_threads(struc
        return 0;
  }
  
 -static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path)
 +static struct file *open_firmware_file(struct bcm_mini_adapter *Adapter, const char *path)
  {
-       struct file *flp = NULL;
-       mm_segment_t oldfs;
-       oldfs = get_fs();
-       set_fs(get_ds());
-       flp = filp_open(path, O_RDONLY, S_IRWXU);
-       set_fs(oldfs);
+       struct file *flp = filp_open(path, O_RDONLY, S_IRWXU);
        if (IS_ERR(flp)) {
                pr_err(DRV_NAME "Unable To Open File %s, err %ld", path, PTR_ERR(flp));
                flp = NULL;
        return status;
  }
  
 -static int bcm_parse_target_params(PMINI_ADAPTER Adapter)
 +static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter)
  {
        struct file *flp = NULL;
-       mm_segment_t oldfs = {0};
        char *buff;
        int len = 0;
-       loff_t pos = 0;
  
        buff = kmalloc(BUFFER_1K, GFP_KERNEL);
        if (!buff)
Simple merge
@@@ -173,8 -174,7 +173,7 @@@ int usb_boot(struct usb_device *usbdev
        filp = filp_open(img_name, O_RDONLY | O_LARGEFILE, 0);
        if (IS_ERR(filp)) {
                printk(KERN_ERR "Can't find %s.\n", img_name);
-               set_fs(fs);
 -              ret = -ENOENT;
 +              ret = PTR_ERR(filp);
                goto restore_fs;
        }
  
Simple merge
@@@ -709,12 -706,6 +708,11 @@@ static int fsg_lun_open(struct fsg_lun 
                goto out;
        }
  
 +      if (fsg_lun_is_open(curlun))
 +              fsg_lun_close(curlun);
 +
-       get_file(filp);
 +      curlun->blksize = blksize;
 +      curlun->blkbits = blkbits;
        curlun->ro = ro;
        curlun->filp = filp;
        curlun->file_length = size;
Simple merge
Simple merge
Simple merge
@@@ -545,9 -530,9 +548,11 @@@ static int __btrfs_end_transaction(stru
                }
                count++;
        }
 +      btrfs_trans_release_metadata(trans, root);
 +      trans->block_rsv = NULL;
  
+       sb_end_intwrite(root->fs_info->sb);
        if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) &&
            should_end_transaction(trans, root)) {
                trans->transaction->blocked = 1;
diff --cc fs/exec.c
Simple merge
diff --cc fs/ext2/super.c
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/ext4/super.c
Simple merge
diff --cc fs/gfs2/file.c
@@@ -373,19 -369,12 +373,18 @@@ static int gfs2_page_mkwrite(struct vm_
        loff_t size;
        int ret;
  
-       /* Wait if fs is frozen. This is racy so we check again later on
-        * and retry if the fs has been frozen after the page lock has
-        * been acquired
-        */
-       vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
+       sb_start_pagefault(inode->i_sb);
+       /* Update file times before taking page lock */
+       file_update_time(vma->vm_file);
  
 +      ret = gfs2_rs_alloc(ip);
 +      if (ret)
 +              return ret;
 +
 +      atomic_set(&ip->i_res->rs_sizehint,
 +                 PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift);
 +
        gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
        ret = gfs2_glock_nq(&gh);
        if (ret)
diff --cc fs/inode.c
@@@ -1551,11 -1553,11 +1553,13 @@@ void touch_atime(struct path *path
         * Btrfs), but since we touch atime while walking down the path we
         * really don't care if we failed to update the atime of the file,
         * so just ignore the return value.
 +       * We may also fail on filesystems that have the ability to make parts
 +       * of the fs read only, e.g. subvolumes in Btrfs.
         */
        update_time(inode, &now, S_ATIME);
-       mnt_drop_write(mnt);
+       __mnt_drop_write(mnt);
+ skip_update:
+       sb_end_write(inode->i_sb);
  }
  EXPORT_SYMBOL(touch_atime);
  
Simple merge
Simple merge
Simple merge
diff --cc fs/nfsd/vfs.c
Simple merge
Simple merge
diff --cc fs/pipe.c
Simple merge
diff --cc fs/super.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc kernel/audit.c
Simple merge
diff --cc kernel/sysctl.c
Simple merge
diff --cc mm/memory.c
Simple merge
Simple merge