Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f248c9c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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
parents f6cec0ae dca33252
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -92,8 +92,8 @@ prototypes:
	void (*destroy_inode)(struct inode *);
	void (*dirty_inode) (struct inode *);
	int (*write_inode) (struct inode *, int);
	void (*drop_inode) (struct inode *);
	void (*delete_inode) (struct inode *);
	int (*drop_inode) (struct inode *);
	void (*evict_inode) (struct inode *);
	void (*put_super) (struct super_block *);
	void (*write_super) (struct super_block *);
	int (*sync_fs)(struct super_block *sb, int wait);
@@ -101,14 +101,13 @@ prototypes:
	int (*unfreeze_fs) (struct super_block *);
	int (*statfs) (struct dentry *, struct kstatfs *);
	int (*remount_fs) (struct super_block *, int *, char *);
	void (*clear_inode) (struct inode *);
	void (*umount_begin) (struct super_block *);
	int (*show_options)(struct seq_file *, struct vfsmount *);
	ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
	ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);

locking rules:
	All may block.
	All may block [not true, see below]
	None have BKL
			s_umount
alloc_inode:
@@ -116,22 +115,25 @@ destroy_inode:
dirty_inode:				(must not sleep)
write_inode:
drop_inode:				!!!inode_lock!!!
delete_inode:
evict_inode:
put_super:		write
write_super:		read
sync_fs:		read
freeze_fs:		read
unfreeze_fs:		read
statfs:			no
remount_fs:		maybe		(see below)
clear_inode:
statfs:			maybe(read)	(see below)
remount_fs:		write
umount_begin:		no
show_options:		no		(namespace_sem)
quota_read:		no		(see below)
quota_write:		no		(see below)

->remount_fs() will have the s_umount exclusive lock if it's already mounted.
When called from get_sb_single, it does NOT have the s_umount lock.
->statfs() has s_umount (shared) when called by ustat(2) (native or
compat), but that's an accident of bad API; s_umount is used to pin
the superblock down when we only have dev_t given us by userland to
identify the superblock.  Everything else (statfs(), fstatfs(), etc.)
doesn't hold it when calling ->statfs() - superblock is pinned down
by resolving the pathname passed to syscall.
->quota_read() and ->quota_write() functions are both guaranteed to
be the only ones operating on the quota file by the quota code (via
dqio_sem) (unless an admin really wants to screw up something and
+45 −0
Original line number Diff line number Diff line
@@ -273,3 +273,48 @@ it's safe to remove it. If you don't need it, remove it.
deliberate; as soon as struct block_device * is propagated in a reasonable
way by that code fixing will become trivial; until then nothing can be
done.

[mandatory]

	block truncatation on error exit from ->write_begin, and ->direct_IO
moved from generic methods (block_write_begin, cont_write_begin,
nobh_write_begin, blockdev_direct_IO*) to callers.  Take a look at
ext2_write_failed and callers for an example.

[mandatory]

	->truncate is going away.  The whole truncate sequence needs to be
implemented in ->setattr, which is now mandatory for filesystems
implementing on-disk size changes.  Start with a copy of the old inode_setattr
and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to
be in order of zeroing blocks using block_truncate_page or similar helpers,
size update and on finally on-disk truncation which should not fail.
inode_change_ok now includes the size checks for ATTR_SIZE and must be called
in the beginning of ->setattr unconditionally.

[mandatory]

	->clear_inode() and ->delete_inode() are gone; ->evict_inode() should
be used instead.  It gets called whenever the inode is evicted, whether it has
remaining links or not.  Caller does *not* evict the pagecache or inode-associated
metadata buffers; getting rid of those is responsibility of method, as it had
been for ->delete_inode().
	->drop_inode() returns int now; it's called on final iput() with inode_lock
held and it returns true if filesystems wants the inode to be dropped.  As before,
generic_drop_inode() is still the default and it's been updated appropriately.
generic_delete_inode() is also alive and it consists simply of return 1.  Note that
all actual eviction work is done by caller after ->drop_inode() returns.
	clear_inode() is gone; use end_writeback() instead.  As before, it must
be called exactly once on each call of ->evict_inode() (as it used to be for
each call of ->delete_inode()).  Unlike before, if you are using inode-associated
metadata buffers (i.e. mark_buffer_dirty_inode()), it's your responsibility to
call invalidate_inode_buffers() before end_writeback().
	No async writeback (and thus no calls of ->write_inode()) will happen
after end_writeback() returns, so actions that should not overlap with ->write_inode()
(e.g. freeing on-disk inode if i_nlink is 0) ought to be done after that call.

	NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out
if it's zero is not *and* *never* *had* *been* enough.  Final unlink() and iput()
may happen while the inode is in the middle of ->write_inode(); e.g. if you blindly
free the on-disk inode, you may end up doing that while ->write_inode() is writing
to it.
+4 −4
Original line number Diff line number Diff line
@@ -234,11 +234,11 @@ linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_st
}

static int
do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
do_osf_statfs(struct path *path, struct osf_statfs __user *buffer,
	      unsigned long bufsiz)
{
	struct kstatfs linux_stat;
	int error = vfs_statfs(dentry, &linux_stat);
	int error = vfs_statfs(path, &linux_stat);
	if (!error)
		error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
	return error;	
@@ -252,7 +252,7 @@ SYSCALL_DEFINE3(osf_statfs, char __user *, pathname,

	retval = user_path(pathname, &path);
	if (!retval) {
		retval = do_osf_statfs(path.dentry, buffer, bufsiz);
		retval = do_osf_statfs(&path buffer, bufsiz);
		path_put(&path);
	}
	return retval;
@@ -267,7 +267,7 @@ SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
	retval = -EBADF;
	file = fget(fd);
	if (file) {
		retval = do_osf_statfs(file->f_path.dentry, buffer, bufsiz);
		retval = do_osf_statfs(&file->f_path, buffer, bufsiz);
		fput(file);
	}
	return retval;
+8 −4
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ struct statfs {
	/* Linux specials */
	__kernel_fsid_t	f_fsid;
	long		f_namelen;
	long		f_spare[6];
	long		f_flags;
	long		f_spare[5];
};

#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
@@ -53,7 +54,8 @@ struct statfs64 {
	__u64	f_bavail;
	__kernel_fsid_t f_fsid;
	__u32	f_namelen;
	__u32	f_spare[6];
	__u32	f_flags;
	__u32	f_spare[5];
};

#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -73,7 +75,8 @@ struct statfs64 { /* Same as struct statfs */
	/* Linux specials */
	__kernel_fsid_t	f_fsid;
	long		f_namelen;
	long		f_spare[6];
	long		f_flags;
	long		f_spare[5];
};

struct compat_statfs64 {
@@ -88,7 +91,8 @@ struct compat_statfs64 {
	__u64	f_bavail;
	__kernel_fsid_t f_fsid;
	__u32	f_namelen;
	__u32	f_spare[6];
	__u32	f_flags;
	__u32	f_spare[5];
};

#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+5 −5
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
	s = user_get_super(dev);
	if (s == NULL)
		goto out;
	err = vfs_statfs(s->s_root, &sbuf);
	err = statfs_by_dentry(s->s_root, &sbuf);
	drop_super(s);
	if (err)
		goto out;
@@ -186,12 +186,12 @@ struct hpux_statfs {
     int16_t f_pad;
};

static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf)
{
	struct kstatfs st;
	int retval;
	
	retval = vfs_statfs(dentry, &st);
	retval = vfs_statfs(path, &st);
	if (retval)
		return retval;

@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *pathname,
	error = user_path(pathname, &path);
	if (!error) {
		struct hpux_statfs tmp;
		error = vfs_statfs_hpux(path.dentry, &tmp);
		error = do_statfs_hpux(&path, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
	file = fget(fd);
	if (!file)
		goto out;
	error = vfs_statfs_hpux(file->f_path.dentry, &tmp);
	error = do_statfs_hpux(&file->f_path, &tmp);
	if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
		error = -EFAULT;
	fput(file);
Loading