Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs

Pull more vfs updates from Al Viro:
 "Assorted VFS fixes and related cleanups (IMO the most interesting in
  that part are f_path-related things and Eric's descriptor-related
  stuff).  UFS regression fixes (it got broken last cycle).  9P fixes.
  fs-cache series, DAX patches, Jan's file_remove_suid() work"

[ I'd say this is much more than "fixes and related cleanups".  The
  file_table locking rule change by Eric Dumazet is a rather big and
  fundamental update even if the patch isn't huge.   - Linus ]

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits)
  9p: cope with bogus responses from server in p9_client_{read,write}
  p9_client_write(): avoid double p9_free_req()
  9p: forgetting to cancel request on interrupted zero-copy RPC
  dax: bdev_direct_access() may sleep
  block: Add support for DAX reads/writes to block devices
  dax: Use copy_from_iter_nocache
  dax: Add block size note to documentation
  fs/file.c: __fget() and dup2() atomicity rules
  fs/file.c: don't acquire files->file_lock in fd_install()
  fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation
  vfs: avoid creation of inode number 0 in get_next_ino
  namei: make set_root_rcu() return void
  make simple_positive() public
  ufs: use dir_pages instead of ufs_dir_pages()
  pagemap.h: move dir_pages() over there
  remove the pointless include of lglock.h
  fs: cleanup slight list_entry abuse
  xfs: Correctly lock inode when removing suid and file capabilities
  fs: Call security_ops->inode_killpriv on truncate
  fs: Provide function telling whether file_remove_privs() will do anything
  ...
  • Loading branch information
Linus Torvalds committed Jul 5, 2015
2 parents 9b284cb + 0f1db7d commit 1dc51b8
Showing 99 changed files with 784 additions and 553 deletions.
23 changes: 23 additions & 0 deletions Documentation/filesystems/caching/backend-api.txt
Original file line number Diff line number Diff line change
@@ -676,6 +676,29 @@ FS-Cache provides some utilities that a cache backend may make use of:
as possible.


(*) Indicate that a stale object was found and discarded:

void fscache_object_retrying_stale(struct fscache_object *object);

This is called to indicate that the lookup procedure found an object in
the cache that the netfs decided was stale. The object has been
discarded from the cache and the lookup will be performed again.


(*) Indicate that the caching backend killed an object:

void fscache_object_mark_killed(struct fscache_object *object,
enum fscache_why_object_killed why);

This is called to indicate that the cache backend preemptively killed an
object. The why parameter should be set to indicate the reason:

FSCACHE_OBJECT_IS_STALE - the object was stale and needs discarding.
FSCACHE_OBJECT_NO_SPACE - there was insufficient cache space
FSCACHE_OBJECT_WAS_RETIRED - the object was retired when relinquished.
FSCACHE_OBJECT_WAS_CULLED - the object was culled to make space.


(*) Get and release references on a retrieval record:

void fscache_get_retrieval(struct fscache_retrieval *op);
7 changes: 6 additions & 1 deletion Documentation/filesystems/caching/fscache.txt
Original file line number Diff line number Diff line change
@@ -284,8 +284,9 @@ proc files.
enq=N Number of times async ops queued for processing
can=N Number of async ops cancelled
rej=N Number of async ops rejected due to object lookup/create failure
ini=N Number of async ops initialised
dfr=N Number of async ops queued for deferred release
rel=N Number of async ops released
rel=N Number of async ops released (should equal ini=N when idle)
gc=N Number of deferred-release async ops garbage collected
CacheOp alo=N Number of in-progress alloc_object() cache ops
luo=N Number of in-progress lookup_object() cache ops
@@ -303,6 +304,10 @@ proc files.
wrp=N Number of in-progress write_page() cache ops
ucp=N Number of in-progress uncache_page() cache ops
dsp=N Number of in-progress dissociate_pages() cache ops
CacheEv nsp=N Number of object lookups/creations rejected due to lack of space
stl=N Number of stale objects deleted
rtr=N Number of objects retired when relinquished
cul=N Number of objects culled


(*) /proc/fs/fscache/histogram
6 changes: 4 additions & 2 deletions Documentation/filesystems/dax.txt
Original file line number Diff line number Diff line change
@@ -18,8 +18,10 @@ Usage
-----

If you have a block device which supports DAX, you can make a filesystem
on it as usual. When mounting it, use the -o dax option manually
or add 'dax' to the options in /etc/fstab.
on it as usual. The DAX code currently only supports files with a block
size equal to your kernel's PAGE_SIZE, so you may need to specify a block
size when creating the filesystem. When mounting it, use the "-o dax"
option on the command line or add 'dax' to the options in /etc/fstab.


Implementation Tips for Block Driver Writers
4 changes: 4 additions & 0 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
@@ -500,3 +500,7 @@ in your dentry operations instead.
dentry, it does not get nameidata at all and it gets called only when cookie
is non-NULL. Note that link body isn't available anymore, so if you need it,
store it as cookie.
--
[mandatory]
__fd_install() & fd_install() can now sleep. Callers should not
hold a spinlock or other resources that do not allow a schedule.
10 changes: 3 additions & 7 deletions arch/arc/kernel/troubleshoot.c
Original file line number Diff line number Diff line change
@@ -71,15 +71,12 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf)
mmput(mm);

if (exe_file) {
path = exe_file->f_path;
path_get(&exe_file->f_path);
path_nm = file_path(exe_file, buf, 255);
fput(exe_file);
path_nm = d_path(&path, buf, 255);
path_put(&path);
}

done:
pr_info("Path: %s\n", path_nm);
pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?");
}

static void show_faulting_vma(unsigned long address, char *buf)
@@ -103,8 +100,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
if (vma && (vma->vm_start <= address)) {
struct file *file = vma->vm_file;
if (file) {
struct path *path = &file->f_path;
nm = d_path(path, buf, PAGE_SIZE - 1);
nm = file_path(file, buf, PAGE_SIZE - 1);
inode = file_inode(vma->vm_file);
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
2 changes: 1 addition & 1 deletion arch/blackfin/kernel/trace.c
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ void decode_address(char *buf, unsigned long address)
struct file *file = vma->vm_file;

if (file) {
char *d_name = d_path(&file->f_path, _tmpbuf,
char *d_name = file_path(file, _tmpbuf,
sizeof(_tmpbuf));
if (!IS_ERR(d_name))
name = d_name;
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ static void spufs_prune_dir(struct dentry *dir)
mutex_lock(&d_inode(dir)->i_mutex);
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
spin_lock(&dentry->d_lock);
if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) {
if (simple_positive(dentry)) {
dget_dlock(dentry);
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
7 changes: 1 addition & 6 deletions arch/s390/hypfs/inode.c
Original file line number Diff line number Diff line change
@@ -62,18 +62,13 @@ static void hypfs_add_dentry(struct dentry *dentry)
hypfs_last_dentry = dentry;
}

static inline int hypfs_positive(struct dentry *dentry)
{
return d_really_is_positive(dentry) && !d_unhashed(dentry);
}

static void hypfs_remove(struct dentry *dentry)
{
struct dentry *parent;

parent = dentry->d_parent;
mutex_lock(&d_inode(parent)->i_mutex);
if (hypfs_positive(dentry)) {
if (simple_positive(dentry)) {
if (d_is_dir(dentry))
simple_rmdir(d_inode(parent), dentry);
else
2 changes: 1 addition & 1 deletion arch/tile/kernel/stack.c
Original file line number Diff line number Diff line change
@@ -332,7 +332,7 @@ static void describe_addr(struct KBacktraceIterator *kbt,
}

if (vma->vm_file) {
p = d_path(&vma->vm_file->f_path, buf, bufsize);
p = file_path(vma->vm_file, buf, bufsize);
if (IS_ERR(p))
p = "?";
name = kbasename(p);
2 changes: 1 addition & 1 deletion arch/tile/mm/elf.c
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ static int notify_exec(struct mm_struct *mm)
if (exe_file == NULL)
goto done_free;

path = d_path(&exe_file->f_path, buf, PAGE_SIZE);
path = file_path(exe_file, buf, PAGE_SIZE);
if (IS_ERR(path))
goto done_put;

10 changes: 1 addition & 9 deletions drivers/block/drbd/drbd_debugfs.c
Original file line number Diff line number Diff line change
@@ -419,14 +419,6 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
return 0;
}

/* simple_positive(file->f_path.dentry) respectively debugfs_positive(),
* but neither is "reachable" from here.
* So we have our own inline version of it above. :-( */
static inline int debugfs_positive(struct dentry *dentry)
{
return d_really_is_positive(dentry) && !d_unhashed(dentry);
}

/* make sure at *open* time that the respective object won't go away. */
static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, void *),
void *data, struct kref *kref,
@@ -444,7 +436,7 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo
/* serialize with d_delete() */
mutex_lock(&d_inode(parent)->i_mutex);
/* Make sure the object is still alive */
if (debugfs_positive(file->f_path.dentry)
if (simple_positive(file->f_path.dentry)
&& kref_get_unless_zero(kref))
ret = 0;
mutex_unlock(&d_inode(parent)->i_mutex);
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
@@ -588,7 +588,7 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)

spin_lock_irq(&lo->lo_lock);
if (lo->lo_backing_file)
p = d_path(&lo->lo_backing_file->f_path, buf, PAGE_SIZE - 1);
p = file_path(lo->lo_backing_file, buf, PAGE_SIZE - 1);
spin_unlock_irq(&lo->lo_lock);

if (IS_ERR_OR_NULL(p))
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_fs.c
Original file line number Diff line number Diff line change
@@ -277,7 +277,7 @@ static int remove_file(struct dentry *parent, char *name)
}

spin_lock(&tmp->d_lock);
if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
if (simple_positive(tmp)) {
dget_dlock(tmp);
__d_drop(tmp);
spin_unlock(&tmp->d_lock);
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/qib/qib_fs.c
Original file line number Diff line number Diff line change
@@ -455,7 +455,7 @@ static int remove_file(struct dentry *parent, char *name)
}

spin_lock(&tmp->d_lock);
if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
if (simple_positive(tmp)) {
__d_drop(tmp);
spin_unlock(&tmp->d_lock);
simple_unlink(d_inode(parent), tmp);
4 changes: 2 additions & 2 deletions drivers/md/bitmap.c
Original file line number Diff line number Diff line change
@@ -839,7 +839,7 @@ static void bitmap_file_kick(struct bitmap *bitmap)
if (bitmap->storage.file) {
path = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (path)
ptr = d_path(&bitmap->storage.file->f_path,
ptr = file_path(bitmap->storage.file,
path, PAGE_SIZE);

printk(KERN_ALERT
@@ -1927,7 +1927,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
chunk_kb ? "KB" : "B");
if (bitmap->storage.file) {
seq_printf(seq, ", file: ");
seq_path(seq, &bitmap->storage.file->f_path, " \t\n");
seq_file_path(seq, bitmap->storage.file, " \t\n");
}

seq_printf(seq, "\n");
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
@@ -5766,7 +5766,7 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg)
/* bitmap disabled, zero the first byte and copy out */
if (!mddev->bitmap_info.file)
file->pathname[0] = '\0';
else if ((ptr = d_path(&mddev->bitmap_info.file->f_path,
else if ((ptr = file_path(mddev->bitmap_info.file,
file->pathname, sizeof(file->pathname))),
IS_ERR(ptr))
err = PTR_ERR(ptr);
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_mass_storage.c
Original file line number Diff line number Diff line change
@@ -2936,7 +2936,7 @@ int fsg_common_create_lun(struct fsg_common *common, struct fsg_lun_config *cfg,
if (fsg_lun_is_open(lun)) {
p = "(error)";
if (pathbuf) {
p = d_path(&lun->filp->f_path, pathbuf, PATH_MAX);
p = file_path(lun->filp, pathbuf, PATH_MAX);
if (IS_ERR(p))
p = "(error)";
}
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/storage_common.c
Original file line number Diff line number Diff line change
@@ -341,7 +341,7 @@ ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem,

down_read(filesem);
if (fsg_lun_is_open(curlun)) { /* Get the complete pathname */
p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1);
p = file_path(curlun->filp, buf, PAGE_SIZE - 1);
if (IS_ERR(p))
rc = PTR_ERR(p);
else {
2 changes: 1 addition & 1 deletion fs/affs/affs.h
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ struct affs_inode_info {
/* short cut to get to the affs specific inode data */
static inline struct affs_inode_info *AFFS_I(struct inode *inode)
{
return list_entry(inode, struct affs_inode_info, vfs_inode);
return container_of(inode, struct affs_inode_info, vfs_inode);
}

/*
5 changes: 0 additions & 5 deletions fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
@@ -238,11 +238,6 @@ static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi)
return d_inode(sbi->sb->s_root)->i_ino;
}

static inline int simple_positive(struct dentry *dentry)
{
return d_really_is_positive(dentry) && !d_unhashed(dentry);
}

static inline void __autofs4_add_expiring(struct dentry *dentry)
{
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
2 changes: 1 addition & 1 deletion fs/befs/befs.h
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ BEFS_SB(const struct super_block *super)
static inline struct befs_inode_info *
BEFS_I(const struct inode *inode)
{
return list_entry(inode, struct befs_inode_info, vfs_inode);
return container_of(inode, struct befs_inode_info, vfs_inode);
}

static inline befs_blocknr_t
4 changes: 2 additions & 2 deletions fs/binfmt_elf.c
Original file line number Diff line number Diff line change
@@ -1530,7 +1530,7 @@ static int fill_files_note(struct memelfnote *note)
file = vma->vm_file;
if (!file)
continue;
filename = d_path(&file->f_path, name_curpos, remaining);
filename = file_path(file, name_curpos, remaining);
if (IS_ERR(filename)) {
if (PTR_ERR(filename) == -ENAMETOOLONG) {
vfree(data);
@@ -1540,7 +1540,7 @@ static int fill_files_note(struct memelfnote *note)
continue;
}

/* d_path() fills at the end, move name down */
/* file_path() fills at the end, move name down */
/* n = strlen(filename) + 1: */
n = (name_curpos + remaining) - filename;
remaining = filename - name_curpos;
10 changes: 10 additions & 0 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
@@ -152,6 +152,9 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;

if (IS_DAX(inode))
return dax_do_io(iocb, inode, iter, offset, blkdev_get_block,
NULL, DIO_SKIP_DIO_COUNT);
return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset,
blkdev_get_block, NULL, NULL,
DIO_SKIP_DIO_COUNT);
@@ -443,6 +446,12 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector,
long avail;
const struct block_device_operations *ops = bdev->bd_disk->fops;

/*
* The device driver is allowed to sleep, in order to make the
* memory directly accessible.
*/
might_sleep();

if (size < 0)
return size;
if (!ops->direct_access)
@@ -1170,6 +1179,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
bdev->bd_disk = disk;
bdev->bd_queue = disk->queue;
bdev->bd_contains = bdev;
bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0;
if (!partno) {
ret = -ENXIO;
bdev->bd_part = disk_get_part(disk, partno);
2 changes: 1 addition & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
@@ -1748,7 +1748,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
}

current->backing_dev_info = inode_to_bdi(inode);
err = file_remove_suid(file);
err = file_remove_privs(file);
if (err) {
mutex_unlock(&inode->i_mutex);
goto out;
1 change: 0 additions & 1 deletion fs/cachefiles/internal.h
Original file line number Diff line number Diff line change
@@ -43,7 +43,6 @@ struct cachefiles_object {
loff_t i_size; /* object size */
unsigned long flags;
#define CACHEFILES_OBJECT_ACTIVE 0 /* T if marked active */
#define CACHEFILES_OBJECT_BURIED 1 /* T if preemptively buried */
atomic_t usage; /* object usage count */
uint8_t type; /* object type */
uint8_t new; /* T if object new */
Loading

0 comments on commit 1dc51b8

Please sign in to comment.