aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAge
* Merge branch 'for-linus' of ↵Linus Torvalds2010-08-10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (96 commits) no need for list_for_each_entry_safe()/resetting with superblock list Fix sget() race with failing mount vfs: don't hold s_umount over close_bdev_exclusive() call sysv: do not mark superblock dirty on remount sysv: do not mark superblock dirty on mount btrfs: remove junk sb_dirt change BFS: clean up the superblock usage AFFS: wait for sb synchronization when needed AFFS: clean up dirty flag usage cifs: truncate fallout mbcache: fix shrinker function return value mbcache: Remove unused features add f_flags to struct statfs(64) pass a struct path to vfs_statfs update VFS documentation for method changes. All filesystems that need invalidate_inode_buffers() are doing that explicitly convert remaining ->clear_inode() to ->evict_inode() Make ->drop_inode() just return whether inode needs to be dropped fs/inode.c:clear_inode() is gone fs/inode.c:evict() doesn't care about delete vs. non-delete paths now ... Fix up trivial conflicts in fs/nilfs2/super.c
| * no need for list_for_each_entry_safe()/resetting with superblock listAl Viro2010-08-09
| | | | | | | | | | | | just delay __put_super() a bit Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * Fix sget() race with failing mountAl Viro2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If sget() finds a matching superblock being set up, it'll grab an active reference to it and grab s_umount. That's fine - we'll wait for completion of foofs_get_sb() that way. However, if said foofs_get_sb() fails we'll end up holding the halfway-created superblock. deactivate_locked_super() called by foofs_get_sb() will just unlock the sucker since we are holding another active reference to it. What we need is a way to tell if superblock has been successfully set up. Unfortunately, neither ->s_root nor the check for MS_ACTIVE quite fit. Cheap and easy way, suitable for backport: new flag set by the (only) caller of ->get_sb(). If that flag isn't present by the time sget() grabbed s_umount on preexisting superblock it has found, it's seeing a stillborn and should just bury it with deactivate_locked_super() (and repeat the search). Longer term we want to set that flag in ->get_sb() instances (and check for it to distinguish between "sget() found us a live sb" and "sget() has allocated an sb, we need to set it up" in there, instead of checking ->s_root as we do now). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: stable@kernel.org
| * vfs: don't hold s_umount over close_bdev_exclusive() callTejun Heo2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an obscure AB-BA deadlock in get_sb_bdev(). When a superblock is mounted more than once get_sb_bdev() calls close_bdev_exclusive() to drop the extra bdev reference while holding s_umount. However, sb->s_umount nests inside bd_mutex during __invalidate_device() and close_bdev_exclusive() acquires bd_mutex during blkdev_put(); thus creating an AB-BA deadlock. This condition doesn't trigger frequently. For this condition to be visible to lockdep, the filesystem must occupy the whole device (as __invalidate_device() only grabs bd_mutex for the whole device), the FS must be mounted more than once and partition rescan should be issued while the FS is still mounted. Fix it by dropping s_umount over close_bdev_exclusive(). Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Ciprian Docan <docan@eden.rutgers.edu> Cc: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * sysv: do not mark superblock dirty on remountArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No need to mark the superblock as dirty in sysv_remount, synchronize it instead (only if mounting R/O). I did not find any docs about this file-system, and I have no possibility to test my changes. Thus, this is untested. I see other issues in sysv, e.g., why sysv_sync_fs writes only in the FSTYPE_SYSV4 case? However, it marks its SB bh's dirty for all types, and does not wait for them ever. With zero docs I'm unable to fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * sysv: do not mark superblock dirty on mountArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | I did not find any docs about this file-system, and I have no possibility to test my changes. Thus, this is untested. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * btrfs: remove junk sb_dirt changeArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | | | BTRFS does not define a '->write_super()' method, so it should not mark its superblock as dirty. This looks like some left-over. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Acked-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * BFS: clean up the superblock usageArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BFS is a very simple FS and its superblocks contains only static information and is never changed. However, the BFS code for some misterious reasons marked its buffer head as dirty from time to time, but nothing in that buffer was ever changed. This patch removes all the BFS superblock manipulation, simply because it is not needed. It removes: 1. The si_sbh filed from 'struct bfs_sb_info' because it is not needed. We only need to read the SB once on mount to get the start of data blocks and the FS size. After this, we can forget about the SB. 2. All instances of 'mark_buffer_dirty(sbh)' for BFS SB because it is never changed. 3. The '->sync_fs()' method because there is nothing to sync (inodes are synched by VFS). 4. The '->write_super()' method, again, because the SB is never changed. Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * AFFS: wait for sb synchronization when neededArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AFFS does not ever wait for superblock synchronization in ->put_super(), ->write_super, and ->sync_fs(). However, it should wait for synchronization in ->put_super() because it is about to be unmounted, in ->write_super() because this is periodic SB synchronization performed from a separate kernel thread, and in ->sync_fs() it should respect the 'wait' flag. This patch fixes the situation. Also, in ->put_super(), do not write the SB if it is not dirty. Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * AFFS: clean up dirty flag usageArtem Bityutskiy2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | In 'affs_write_super()': remove ancient and wrong commented code, remove unneeded 'clean' variable, so the function becomes a bit cleaner and simpler. In 'affs_remount(): remove unnecessary SB dirty flag changes. Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * cifs: truncate falloutChristoph Hellwig2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the calls to inode_newsize_ok given that we already did it as part of inode_change_ok in the beginning of cifs_setattr_(no)unix. No need to call ->truncate if cifs doesn't have one, so remove the explicit call in cifs_vmtruncate, and replace the calls to vmtruncate with truncate_setsize which is vmtruncate minus inode_newsize_ok and the call to ->truncate. Rename cifs_vmtruncate to cifs_setsize to match the new calling conventions. Question 1: why does cifs do the pagecache munging and i_size update twice for each setattr call, once opencoded in cifs_vmtruncate, and once using the VFS helpers? Question 2: what is supposed to be protected by i_lock in cifs_vmtruncate? Do we need it around the call to inode_change_ok? [AV: fixed build breakage] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * mbcache: fix shrinker function return valueAndreas Gruenbacher2010-08-09
| | | | | | | | | | | | | | | | | | | | The shrinker function is supposed to return the number of cache entries after shrinking, not before shrinking. Fix that. Based on a patch from Wang Sheng-Hui <crosslonelyover@gmail.com>. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * mbcache: Remove unused featuresAndreas Gruenbacher2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | The mbcache code was written to support a variable number of indexes, but all the existing users use exactly one index. Simplify to code to support only that case. There are also no users of the cache entry free operation, and none of the users keep extra data in cache entries. Remove those features as well. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * add f_flags to struct statfs(64)Christoph Hellwig2010-08-09
| | | | | | | | | | | | | | | | | | | | Add a flags field to help glibc implementing statvfs(3) efficiently. We copy the flag values from glibc, and add a new ST_VALID flag to denote that f_flags is implemented. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * pass a struct path to vfs_statfsChristoph Hellwig2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'll need the path to implement the flags field for statvfs support. We do have it available in all callers except: - ecryptfs_statfs. This one doesn't actually need vfs_statfs but just needs to do a caller to the lower filesystem statfs method. - sys_ustat. Add a non-exported statfs_by_dentry helper for it which doesn't won't be able to fill out the flags field later on. In addition rename the helpers for statfs vs fstatfs to do_*statfs instead of the misleading vfs prefix. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * update VFS documentation for method changes.Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * All filesystems that need invalidate_inode_buffers() are doing that explicitlyAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert remaining ->clear_inode() to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * Make ->drop_inode() just return whether inode needs to be droppedAl Viro2010-08-09
| | | | | | | | | | | | ... and let iput_final() do the actual eviction or retention Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/inode.c:clear_inode() is goneAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/inode.c:evict() doesn't care about delete vs. non-delete paths nowAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ->delete_inode() is goneAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert ext4 to ->evict_inode()Al Viro2010-08-09
| | | | | | | | | | | | pretty much brute-force... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert logfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * logfs: get rid of magical inodesAl Viro2010-08-09
| | | | | | | | | | | | | | ordering problems at ->kill_sb() time are solved by doing iput() of these suckers in ->put_super() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert nilfs2 to ->evict_inode()Al Viro2010-08-09
| | | | | | | | | | | | [folded build fix from sfr] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert exofs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert reiserfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert btrfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | | | | | | | | | | | NB: do we want btrfs_wait_ordered_range() on eviction of inodes with positive i_nlink on subvolume with zero root_refs? If not, btrfs_evict_inode() can be simplified by unconditionally bailing out in case of i_nlink > 0 in the very beginning... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch gfs2 to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * convert ocfs2 to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch ncpfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch udf to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch ubifs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch jfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch hpfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch hppfs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * try to get rid of races in hostfs open()Al Viro2010-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of mode mismatch, do *not* blindly close the descriptor another openers might be using right now. Open the underlying file with currently sufficient mode, then * if current mode has grown so that it's sufficient for us now, just close our new fd * if current mode has grown and our fd is *not* enough to cover it, close and repeat. * otherwise, install our fd if the file hadn't been opened at all or dup2() our fd over the current one (and close our fd). Critical section is protected by mutex; yes, system-wide. All we do under it is a bunch of comparison and maybe an overwriting dup2() on host. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * leak in hostfs_unlink()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: fix races in dentry_name() and inode_name()Al Viro2010-08-09
| | | | | | | | | | | | | | | | calculating size, then doing allocation, then filling the path is a Bad Idea(tm), since the ancestors can be renamed, leading to buffer overrun. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * new helper: __dentry_path()Al Viro2010-08-09
| | | | | | | | | | | | | | builds path relative to fs root, called under dcache_lock, doesn't append any nonsense to unlinked ones. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: sanitize symlinksAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: get rid of inode_dentry_name()Al Viro2010-08-09
| | | | | | | | | | | | it's equivalent to dentry_name() anyway Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: get rid of file_type(), fold init_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch stat_file() to passing a single struct rather than fsckloads of pointersAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: pass pathname to init_inode()Al Viro2010-08-09
| | | | | | | | | | | | | | | | | | We will calculate it in all callers anyway, so there's no need to duplicate that inside. Moreover, that way we lose all failure exits in init_inode(), so it doesn't need to return anything. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * get rid of hostfs_read_inode()Al Viro2010-08-09
| | | | | | | | | | | | | | | | | | There are only two call sites; in one (hostfs_iget()) it's actually a no-op and in another (fill_super()) it's easier to expand the damn thing and use what we know about its arguments to simplify it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hostfs: don't keep a field in each inode when we are using it only in rootAl Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * stop icache pollution in hostfs, switch to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch affs to ->evict_inode()Al Viro2010-08-09
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>