Commit cbfe0de3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull VFS changes from Al Viro:
 "First pile out of several (there _definitely_ will be more).  Stuff in
  this one:

   - unification of d_splice_alias()/d_materialize_unique()

   - iov_iter rewrite

   - killing a bunch of ->f_path.dentry users (and f_dentry macro).

     Getting that completed will make life much simpler for
     unionmount/overlayfs, since then we'll be able to limit the places
     sensitive to file _dentry_ to reasonably few.  Which allows to have
     file_inode(file) pointing to inode in a covered layer, with dentry
     pointing to (negative) dentry in union one.

     Still not complete, but much closer now.

   - crapectomy in lustre (dead code removal, mostly)

   - "let's make seq_printf return nothing" preparations

   - assorted cleanups and fixes

  There _definitely_ will be more piles"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
  copy_from_iter_nocache()
  new helper: iov_iter_kvec()
  csum_and_copy_..._iter()
  iov_iter.c: handle ITER_KVEC directly
  iov_iter.c: convert copy_to_iter() to iterate_and_advance
  iov_iter.c: convert copy_from_iter() to iterate_and_advance
  iov_iter.c: get rid of bvec_copy_page_{to,from}_iter()
  iov_iter.c: convert iov_iter_zero() to iterate_and_advance
  iov_iter.c: convert iov_iter_get_pages_alloc() to iterate_all_kinds
  iov_iter.c: convert iov_iter_get_pages() to iterate_all_kinds
  iov_iter.c: convert iov_iter_npages() to iterate_all_kinds
  iov_iter.c: iterate_and_advance
  iov_iter.c: macros for iterating over iov_iter
  kill f_dentry macro
  dcache: fix kmemcheck warning in switch_names
  new helper: audit_file()
  nfsd_vfs_write(): use file_inode()
  ncpfs: use file_inode()
  kill f_dentry uses
  lockd: get rid of ->f_path.dentry->d_sb
  ...
parents 8322b6fd ba00410b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ file.
				     struct dentry *parent,
				     struct debugfs_regset32 *regset);

    int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
    void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
			 int nregs, void __iomem *base, char *prefix);

The "base" argument may be 0, but you may want to build the reg32 array
+5 −18
Original line number Diff line number Diff line
@@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach
        DCACHE_DISCONNECTED) dentry is allocated and attached.
      In the case of a directory, care is taken that only one dentry
      can ever be attached.
    d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode)
      will introduce a new dentry into the tree; either the passed-in
      dentry or a preexisting alias for the given inode (such as an
      anonymous one created by d_obtain_alias), if appropriate.  The two
      functions differ in their handling of directories with preexisting
      aliases:
        d_splice_alias will use any existing IS_ROOT dentry, but it will
	  return -EIO rather than try to move a dentry with a different
	  parent.  This is appropriate for local filesystems, which
	  should never see such an alias unless the filesystem is
	  corrupted somehow (for example, if two on-disk directory
	  entries refer to the same directory.)
	d_materialise_unique will attempt to move any dentry.  This is
	  appropriate for distributed filesystems, where finding a
	  directory other than where we last cached it may be a normal
	  consequence of concurrent operations on other hosts.
      Both functions return NULL when the passed-in dentry is used,
      following the calling convention of ->lookup.
    d_splice_alias(inode, dentry) will introduce a new dentry into the tree;
      either the passed-in dentry or a preexisting alias for the given inode
      (such as an anonymous one created by d_obtain_alias), if appropriate.
      It returns NULL when the passed-in dentry is used, following the calling
      convention of ->lookup.

 
Filesystem Issues
+8 −0
Original line number Diff line number Diff line
@@ -463,3 +463,11 @@ in your dentry operations instead.
	of the in-tree instances did).  inode_hash_lock is still held,
	of course, so they are still serialized wrt removal from inode hash,
	as well as wrt set() callback of iget5_locked().
--
[mandatory]
	d_materialise_unique() is gone; d_splice_alias() does everything you
	need now.  Remember that they have opposite orders of arguments ;-/
--
[mandatory]
	f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
	it entirely.
+13 −9
Original line number Diff line number Diff line
@@ -180,23 +180,19 @@ output must be passed to the seq_file code. Some utility functions have
been defined which make this task easy.

Most code will simply use seq_printf(), which works pretty much like
printk(), but which requires the seq_file pointer as an argument. It is
common to ignore the return value from seq_printf(), but a function
producing complicated output may want to check that value and quit if
something non-zero is returned; an error return means that the seq_file
buffer has been filled and further output will be discarded.
printk(), but which requires the seq_file pointer as an argument.

For straight character output, the following functions may be used:

	int seq_putc(struct seq_file *m, char c);
	int seq_puts(struct seq_file *m, const char *s);
	int seq_escape(struct seq_file *m, const char *s, const char *esc);
	seq_putc(struct seq_file *m, char c);
	seq_puts(struct seq_file *m, const char *s);
	seq_escape(struct seq_file *m, const char *s, const char *esc);

The first two output a single character and a string, just like one would
expect. seq_escape() is like seq_puts(), except that any character in s
which is in the string esc will be represented in octal form in the output.

There is also a pair of functions for printing filenames:
There are also a pair of functions for printing filenames:

	int seq_path(struct seq_file *m, struct path *path, char *esc);
	int seq_path_root(struct seq_file *m, struct path *path,
@@ -209,6 +205,14 @@ root is desired, it can be used with seq_path_root(). Note that, if it
turns out that path cannot be reached from root, the value of root will be
changed in seq_file_root() to a root which *does* work.

A function producing complicated output may want to check
	bool seq_has_overflowed(struct seq_file *m);
and avoid further seq_<output> calls if true is returned.

A true return from seq_has_overflowed means that the seq_file buffer will
be discarded and the seq_show function will attempt to allocate a larger
buffer and retry printing.


Making it all work

+1 −1
Original line number Diff line number Diff line
@@ -835,7 +835,7 @@ struct file_operations {
	ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
	int (*setlease)(struct file *, long arg, struct file_lock **, void **);
	long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len);
	int (*show_fdinfo)(struct seq_file *m, struct file *f);
	void (*show_fdinfo)(struct seq_file *m, struct file *f);
};

Again, all methods are called without any locks being held, unless
Loading