Skip to content

Commit

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

Pull misc vfs updates from Al Viro:
 "Assorted misc bits and pieces.

  There are several single-topic branches left after this (rename2
  series from Miklos, current_time series from Deepa Dinamani, xattr
  series from Andreas, uaccess stuff from from me) and I'd prefer to
  send those separately"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (39 commits)
  proc: switch auxv to use of __mem_open()
  hpfs: support FIEMAP
  cifs: get rid of unused arguments of CIFSSMBWrite()
  posix_acl: uapi header split
  posix_acl: xattr representation cleanups
  fs/aio.c: eliminate redundant loads in put_aio_ring_file
  fs/internal.h: add const to ns_dentry_operations declaration
  compat: remove compat_printk()
  fs/buffer.c: make __getblk_slow() static
  proc: unsigned file descriptors
  fs/file: more unsigned file descriptors
  fs: compat: remove redundant check of nr_segs
  cachefiles: Fix attempt to read i_blocks after deleting file [ver #2]
  cifs: don't use memcpy() to copy struct iov_iter
  get rid of separate multipage fault-in primitives
  fs: Avoid premature clearing of capabilities
  fs: Give dentry to inode_change_ok() instead of inode
  fuse: Propagate dentry down to inode_change_ok()
  ceph: Propagate dentry down to inode_change_ok()
  xfs: Propagate dentry down to inode_change_ok()
  ...
  • Loading branch information
torvalds committed Oct 10, 2016
2 parents 911f9da + e55f1d1 commit abb5a14
Show file tree
Hide file tree
Showing 136 changed files with 737 additions and 640 deletions.
4 changes: 2 additions & 2 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ 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.
setattr_prepare (which used to be inode_change_ok) now includes the size checks
for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally.

[mandatory]

Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void flush_dcache_page(struct page *page)
!= (addr & (SHM_COLOUR - 1))) {
__flush_cache_page(mpnt, addr, page_to_phys(page));
if (old_addr)
printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? (char *)mpnt->vm_file->f_path.dentry->d_name.name : "(null)");
printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %pD\n", old_addr, addr, mpnt->vm_file);
old_addr = addr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/armada/armada_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
if (!access_ok(VERIFY_READ, ptr, args->size))
return -EFAULT;

ret = fault_in_multipages_readable(ptr, args->size);
ret = fault_in_pages_readable(ptr, args->size);
if (ret)
return ret;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
root, tmp, &drm_debugfs_fops);
if (!ent) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n",
root->d_name.name, files[i].name);
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/%s\n",
root, files[i].name);
kfree(tmp);
ret = -1;
goto fail;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ i915_gem_gtt_pread(struct drm_device *dev,

mutex_unlock(&dev->struct_mutex);
if (likely(!i915.prefault_disable)) {
ret = fault_in_multipages_writeable(user_data, remain);
ret = fault_in_pages_writeable(user_data, remain);
if (ret) {
mutex_lock(&dev->struct_mutex);
goto out_unpin;
Expand Down Expand Up @@ -803,7 +803,7 @@ i915_gem_shmem_pread(struct drm_device *dev,
mutex_unlock(&dev->struct_mutex);

if (likely(!i915.prefault_disable) && !prefaulted) {
ret = fault_in_multipages_writeable(user_data, remain);
ret = fault_in_pages_writeable(user_data, remain);
/* Userspace is tricking us, but we've already clobbered
* its pages with the prefault and promised to write the
* data up to the first fault. Hence ignore any errors
Expand Down Expand Up @@ -1267,7 +1267,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
return -EFAULT;

if (likely(!i915.prefault_disable)) {
ret = fault_in_multipages_readable(u64_to_user_ptr(args->data_ptr),
ret = fault_in_pages_readable(u64_to_user_ptr(args->data_ptr),
args->size);
if (ret)
return -EFAULT;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ validate_exec_list(struct drm_device *dev,
return -EFAULT;

if (likely(!i915.prefault_disable)) {
if (fault_in_multipages_readable(ptr, length))
if (fault_in_pages_readable(ptr, length))
return -EFAULT;
}
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/msm/msm_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ int msm_perf_debugfs_init(struct drm_minor *minor)
perf->ent = debugfs_create_file("perf", S_IFREG | S_IRUGO,
minor->debugfs_root, perf, &perf_debugfs_fops);
if (!perf->ent) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/perf\n",
minor->debugfs_root->d_name.name);
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/perf\n",
minor->debugfs_root);
goto fail;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/msm/msm_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ int msm_rd_debugfs_init(struct drm_minor *minor)
rd->ent = debugfs_create_file("rd", S_IFREG | S_IRUGO,
minor->debugfs_root, rd, &rd_debugfs_fops);
if (!rd->ent) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/rd\n",
minor->debugfs_root->d_name.name);
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/rd\n",
minor->debugfs_root);
goto fail;
}

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2422,14 +2422,12 @@ int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
*/
if (priv->mac80211_registered) {
char buf[100];
struct dentry *mac80211_dir, *dev_dir, *root_dir;
struct dentry *mac80211_dir, *dev_dir;

dev_dir = dbgfs_dir->d_parent;
root_dir = dev_dir->d_parent;
mac80211_dir = priv->hw->wiphy->debugfsdir;

snprintf(buf, 100, "../../%s/%s", root_dir->d_name.name,
dev_dir->d_name.name);
snprintf(buf, 100, "../../%pd2", dev_dir);

if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf))
goto err;
Expand Down
16 changes: 7 additions & 9 deletions drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,8 +1571,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir);

if (!mvmvif->dbgfs_dir) {
IWL_ERR(mvm, "Failed to create debugfs directory under %s\n",
dbgfs_dir->d_name.name);
IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n",
dbgfs_dir);
return;
}

Expand Down Expand Up @@ -1627,17 +1627,15 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
* find
* netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/
*/
snprintf(buf, 100, "../../../%s/%s/%s/%s",
dbgfs_dir->d_parent->d_parent->d_name.name,
dbgfs_dir->d_parent->d_name.name,
dbgfs_dir->d_name.name,
mvmvif->dbgfs_dir->d_name.name);
snprintf(buf, 100, "../../../%pd3/%pd",
dbgfs_dir,
mvmvif->dbgfs_dir);

mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name,
mvm->debugfs_dir, buf);
if (!mvmvif->dbgfs_slink)
IWL_ERR(mvm, "Can't create debugfs symbolic link under %s\n",
dbgfs_dir->d_name.name);
IWL_ERR(mvm, "Can't create debugfs symbolic link under %pd\n",
dbgfs_dir);
return;
err:
IWL_ERR(mvm, "Can't create debugfs entity\n");
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,9 +1748,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
* Create a symlink with mac80211. It will be removed when mac80211
* exists (before the opmode exists which removes the target.)
*/
snprintf(buf, 100, "../../%s/%s",
dbgfs_dir->d_parent->d_parent->d_name.name,
dbgfs_dir->d_parent->d_name.name);
snprintf(buf, 100, "../../%pd2", dbgfs_dir->d_parent);
if (!debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir, buf))
goto err;

Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/lustre/lustre/include/lustre_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include <linux/posix_acl_xattr.h>

#define LUSTRE_POSIX_ACL_MAX_ENTRIES 32
#define LUSTRE_POSIX_ACL_MAX_SIZE \
(sizeof(posix_acl_xattr_header) + \
LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(posix_acl_xattr_entry))
#define LUSTRE_POSIX_ACL_MAX_SIZE \
(sizeof(struct posix_acl_xattr_header) + \
LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(struct posix_acl_xattr_entry))

#endif
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/llite/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
struct cl_io *io;
ssize_t result;

CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: %llu, count: %zu\n",
file->f_path.dentry->d_name.name, iot, *ppos, count);
CDEBUG(D_VFSTRACE, "file: %pD, type: %d ppos: %llu, count: %zu\n",
file, iot, *ppos, count);

restart:
io = vvp_env_thread_io(env);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/llite/llite_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
attr->ia_valid |= ATTR_MTIME | ATTR_CTIME;
}

/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
/* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */
if (attr->ia_valid & TIMES_SET_FLAGS) {
if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
!capable(CFS_CAP_FOWNER))
Expand Down
44 changes: 20 additions & 24 deletions drivers/staging/lustre/lustre/ptlrpc/wiretest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3742,32 +3742,28 @@ void lustre_assert_wire_constants(void)
CLASSERT(FIEMAP_EXTENT_NET == 0x80000000);

/* Checks for type posix_acl_xattr_entry */
LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
(long long)(int)sizeof(posix_acl_xattr_entry));
LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_entry, e_id));
LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
LASSERTF((int)sizeof(struct posix_acl_xattr_entry) == 8, "found %lld\n",
(long long)(int)sizeof(struct posix_acl_xattr_entry));
LASSERTF((int)offsetof(struct posix_acl_xattr_entry, e_tag) == 0, "found %lld\n",
(long long)(int)offsetof(struct posix_acl_xattr_entry, e_tag));
LASSERTF((int)sizeof(((struct posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n",
(long long)(int)sizeof(((struct posix_acl_xattr_entry *)0)->e_tag));
LASSERTF((int)offsetof(struct posix_acl_xattr_entry, e_perm) == 2, "found %lld\n",
(long long)(int)offsetof(struct posix_acl_xattr_entry, e_perm));
LASSERTF((int)sizeof(((struct posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n",
(long long)(int)sizeof(((struct posix_acl_xattr_entry *)0)->e_perm));
LASSERTF((int)offsetof(struct posix_acl_xattr_entry, e_id) == 4, "found %lld\n",
(long long)(int)offsetof(struct posix_acl_xattr_entry, e_id));
LASSERTF((int)sizeof(((struct posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n",
(long long)(int)sizeof(((struct posix_acl_xattr_entry *)0)->e_id));

/* Checks for type posix_acl_xattr_header */
LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
(long long)(int)sizeof(posix_acl_xattr_header));
LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_header, a_version));
LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_header, a_entries));
LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
LASSERTF((int)sizeof(struct posix_acl_xattr_header) == 4, "found %lld\n",
(long long)(int)sizeof(struct posix_acl_xattr_header));
LASSERTF((int)offsetof(struct posix_acl_xattr_header, a_version) == 0, "found %lld\n",
(long long)(int)offsetof(struct posix_acl_xattr_header, a_version));
LASSERTF((int)sizeof(((struct posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
(long long)(int)sizeof(((struct posix_acl_xattr_header *)0)->a_version));

/* Checks for struct link_ea_header */
LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n",
Expand Down
40 changes: 17 additions & 23 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,32 +276,26 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
switch (handler->flags) {
case ACL_TYPE_ACCESS:
if (acl) {
umode_t mode = inode->i_mode;
retval = posix_acl_equiv_mode(acl, &mode);
if (retval < 0)
struct iattr iattr;

retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
if (retval)
goto err_out;
else {
struct iattr iattr;
if (retval == 0) {
/*
* ACL can be represented
* by the mode bits. So don't
* update ACL.
*/
acl = NULL;
value = NULL;
size = 0;
}
/* Updte the mode bits */
iattr.ia_mode = ((mode & S_IALLUGO) |
(inode->i_mode & ~S_IALLUGO));
iattr.ia_valid = ATTR_MODE;
/* FIXME should we update ctime ?
* What is the following setxattr update the
* mode ?
if (!acl) {
/*
* ACL can be represented
* by the mode bits. So don't
* update ACL.
*/
v9fs_vfs_setattr_dotl(dentry, &iattr);
value = NULL;
size = 0;
}
iattr.ia_valid = ATTR_MODE;
/* FIXME should we update ctime ?
* What is the following setxattr update the
* mode ?
*/
v9fs_vfs_setattr_dotl(dentry, &iattr);
}
break;
case ACL_TYPE_DEFAULT:
Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
struct p9_wstat wstat;

p9_debug(P9_DEBUG_VFS, "\n");
retval = inode_change_ok(d_inode(dentry), iattr);
retval = setattr_prepare(dentry, iattr);
if (retval)
return retval;

Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_inode_dotl.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)

p9_debug(P9_DEBUG_VFS, "\n");

retval = inode_change_ok(inode, iattr);
retval = setattr_prepare(dentry, iattr);
if (retval)
return retval;

Expand Down
2 changes: 1 addition & 1 deletion fs/adfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
unsigned int ia_valid = attr->ia_valid;
int error;

error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);

/*
* we can't change the UID or GID of any file -
Expand Down
2 changes: 1 addition & 1 deletion fs/affs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)

pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);

error = inode_change_ok(inode,attr);
error = setattr_prepare(dentry, attr);
if (error)
goto out;

Expand Down
9 changes: 6 additions & 3 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,17 @@ __initcall(aio_setup);
static void put_aio_ring_file(struct kioctx *ctx)
{
struct file *aio_ring_file = ctx->aio_ring_file;
struct address_space *i_mapping;

if (aio_ring_file) {
truncate_setsize(aio_ring_file->f_inode, 0);

/* Prevent further access to the kioctx from migratepages */
spin_lock(&aio_ring_file->f_inode->i_mapping->private_lock);
aio_ring_file->f_inode->i_mapping->private_data = NULL;
i_mapping = aio_ring_file->f_inode->i_mapping;
spin_lock(&i_mapping->private_lock);
i_mapping->private_data = NULL;
ctx->aio_ring_file = NULL;
spin_unlock(&aio_ring_file->f_inode->i_mapping->private_lock);
spin_unlock(&i_mapping->private_lock);

fput(aio_ring_file);
}
Expand Down
Loading

0 comments on commit abb5a14

Please sign in to comment.