From: Linus Torvalds Date: Wed, 1 Aug 2012 17:26:23 +0000 (-0700) Subject: Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs X-Git-Tag: accepted/tizen/common/20141203.182822~4037 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0e881b7c189fa2bd76c024dbff91e79511c971d;p=platform%2Fkernel%2Flinux-arm64.git Merge branch 'for-linus' of git://git./linux/kernel/git/viro/vfs 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 ... --- a0e881b7c189fa2bd76c024dbff91e79511c971d diff --cc drivers/staging/bcm/Misc.c index 9a60d4c,7067af2..f545716 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@@ -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; @@@ -1053,13 -1062,11 +1038,11 @@@ OUT 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) diff --cc drivers/staging/gdm72xx/usb_boot.c index fef290c,b366a54..e3dbd5a --- a/drivers/staging/gdm72xx/usb_boot.c +++ b/drivers/staging/gdm72xx/usb_boot.c @@@ -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; } diff --cc drivers/usb/gadget/storage_common.c index ae8b188,f929432..8d9bcd8 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@@ -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; diff --cc fs/btrfs/transaction.c index 7ac7cdc,fa67ba5..17be3de --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@@ -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/gfs2/file.c index 9aa6af1,8ffeb03..d1d791e --- a/fs/gfs2/file.c +++ b/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 index 3cc5043,74d7c20..ac8d904 --- a/fs/inode.c +++ b/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);