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:
 "No common topic whatsoever in those, sorry"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: define inode flags using bit numbers
  iov_iter: Move unnecessary inclusion of crypto/hash.h
  dlmfs: clean up dlmfs_file_{read,write}() a bit
  • Loading branch information
torvalds committed Aug 8, 2020
2 parents d57b2b5 + 6414e9b commit b79675e
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 75 deletions.
1 change: 1 addition & 0 deletions arch/s390/lib/test_unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/kallsyms.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/kprobes.h>
#include <linux/wait.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/dma/sf-pdma/sf-pdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/mod_devicetable.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
#include <linux/slab.h>

#include "sf-pdma.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/dma/st_fdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/remoteproc.h>
#include <linux/slab.h>

#include "st_fdma.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/dma/uniphier-xdmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#include "dmaengine.h"
#include "virt-dma.h"
Expand Down
1 change: 1 addition & 0 deletions drivers/misc/uacce/uacce.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/uacce.h>

static struct class *uacce_class;
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/mtdpstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/pstore_blk.h>
#include <linux/mtd/mtd.h>
#include <linux/bitops.h>
#include <linux/slab.h>

static struct mtdpstore_context {
int index;
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/nand/raw/cadence-nand-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/mtd/rawnand.h>
#include <linux/of_device.h>
#include <linux/iopoll.h>
#include <linux/slab.h>

/*
* HPNFC can work in 3 modes:
Expand Down
1 change: 1 addition & 0 deletions drivers/remoteproc/qcom_q6v5_mss.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/reset.h>
#include <linux/soc/qcom/mdt_loader.h>
#include <linux/iopoll.h>
#include <linux/slab.h>

#include "remoteproc_internal.h"
#include "qcom_common.h"
Expand Down
1 change: 1 addition & 0 deletions drivers/soc/qcom/pdr_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>

Expand Down
1 change: 1 addition & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2007 Oracle. All rights reserved.
*/

#include <crypto/hash.h>
#include <linux/kernel.h>
#include <linux/bio.h>
#include <linux/buffer_head.h>
Expand Down
52 changes: 8 additions & 44 deletions fs/ocfs2/dlmfs/dlmfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,82 +221,46 @@ static __poll_t dlmfs_file_poll(struct file *file, poll_table *wait)
return event;
}

static ssize_t dlmfs_file_read(struct file *filp,
static ssize_t dlmfs_file_read(struct file *file,
char __user *buf,
size_t count,
loff_t *ppos)
{
int bytes_left;
ssize_t got;
char *lvb_buf;
struct inode *inode = file_inode(filp);

mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
inode->i_ino, count, *ppos);
char lvb[DLM_LVB_LEN];

if (*ppos >= i_size_read(inode))
if (!user_dlm_read_lvb(file_inode(file), lvb))
return 0;

/* don't read past the lvb */
if (count > i_size_read(inode) - *ppos)
count = i_size_read(inode) - *ppos;

if (!count)
return 0;

lvb_buf = kmalloc(count, GFP_NOFS);
if (!lvb_buf)
return -ENOMEM;

got = user_dlm_read_lvb(inode, lvb_buf, count);
if (got) {
BUG_ON(got != count);
bytes_left = copy_to_user(buf, lvb_buf, count);
count -= bytes_left;
} else
count = 0;

kfree(lvb_buf);

*ppos = *ppos + count;

mlog(0, "read %zu bytes\n", count);
return count;
return simple_read_from_buffer(buf, count, ppos, lvb, sizeof(lvb));
}

static ssize_t dlmfs_file_write(struct file *filp,
const char __user *buf,
size_t count,
loff_t *ppos)
{
char lvb_buf[DLM_LVB_LEN];
int bytes_left;
char *lvb_buf;
struct inode *inode = file_inode(filp);

mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
inode->i_ino, count, *ppos);

if (*ppos >= i_size_read(inode))
if (*ppos >= DLM_LVB_LEN)
return -ENOSPC;

/* don't write past the lvb */
if (count > i_size_read(inode) - *ppos)
count = i_size_read(inode) - *ppos;
if (count > DLM_LVB_LEN - *ppos)
count = DLM_LVB_LEN - *ppos;

if (!count)
return 0;

lvb_buf = kmalloc(count, GFP_NOFS);
if (!lvb_buf)
return -ENOMEM;

bytes_left = copy_from_user(lvb_buf, buf, count);
count -= bytes_left;
if (count)
user_dlm_write_lvb(inode, lvb_buf, count);

kfree(lvb_buf);

*ppos = *ppos + count;
mlog(0, "wrote %zu bytes\n", count);
return count;
Expand Down
12 changes: 4 additions & 8 deletions fs/ocfs2/dlmfs/userdlm.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,24 +547,20 @@ void user_dlm_write_lvb(struct inode *inode,
spin_unlock(&lockres->l_lock);
}

ssize_t user_dlm_read_lvb(struct inode *inode,
char *val,
unsigned int len)
bool user_dlm_read_lvb(struct inode *inode, char *val)
{
struct user_lock_res *lockres = &DLMFS_I(inode)->ip_lockres;
char *lvb;
ssize_t ret = len;

BUG_ON(len > DLM_LVB_LEN);
bool ret = true;

spin_lock(&lockres->l_lock);

BUG_ON(lockres->l_level < DLM_LOCK_PR);
if (ocfs2_dlm_lvb_valid(&lockres->l_lksb)) {
lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
memcpy(val, lvb, len);
memcpy(val, lvb, DLM_LVB_LEN);
} else
ret = 0;
ret = false;

spin_unlock(&lockres->l_lock);
return ret;
Expand Down
4 changes: 1 addition & 3 deletions fs/ocfs2/dlmfs/userdlm.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ void user_dlm_cluster_unlock(struct user_lock_res *lockres,
void user_dlm_write_lvb(struct inode *inode,
const char *val,
unsigned int len);
ssize_t user_dlm_read_lvb(struct inode *inode,
char *val,
unsigned int len);
bool user_dlm_read_lvb(struct inode *inode, char *val);
struct ocfs2_cluster_connection *user_dlm_register(const struct qstr *name);
void user_dlm_unregister(struct ocfs2_cluster_connection *conn);
void user_dlm_set_locking_protocol(void);
Expand Down
36 changes: 18 additions & 18 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1946,27 +1946,27 @@ struct super_operations {
/*
* Inode flags - they have no relation to superblock flags now
*/
#define S_SYNC 1 /* Writes are synced at once */
#define S_NOATIME 2 /* Do not update access times */
#define S_APPEND 4 /* Append-only file */
#define S_IMMUTABLE 8 /* Immutable file */
#define S_DEAD 16 /* removed, but still open directory */
#define S_NOQUOTA 32 /* Inode is not counted to quota */
#define S_DIRSYNC 64 /* Directory modifications are synchronous */
#define S_NOCMTIME 128 /* Do not update file c/mtime */
#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
#define S_PRIVATE 512 /* Inode is fs-internal */
#define S_IMA 1024 /* Inode has an associated IMA struct */
#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
#define S_NOSEC 4096 /* no suid or xattr security attributes */
#define S_SYNC (1 << 0) /* Writes are synced at once */
#define S_NOATIME (1 << 1) /* Do not update access times */
#define S_APPEND (1 << 2) /* Append-only file */
#define S_IMMUTABLE (1 << 3) /* Immutable file */
#define S_DEAD (1 << 4) /* removed, but still open directory */
#define S_NOQUOTA (1 << 5) /* Inode is not counted to quota */
#define S_DIRSYNC (1 << 6) /* Directory modifications are synchronous */
#define S_NOCMTIME (1 << 7) /* Do not update file c/mtime */
#define S_SWAPFILE (1 << 8) /* Do not truncate: swapon got its bmaps */
#define S_PRIVATE (1 << 9) /* Inode is fs-internal */
#define S_IMA (1 << 10) /* Inode has an associated IMA struct */
#define S_AUTOMOUNT (1 << 11) /* Automount/referral quasi-directory */
#define S_NOSEC (1 << 12) /* no suid or xattr security attributes */
#ifdef CONFIG_FS_DAX
#define S_DAX 8192 /* Direct Access, avoiding the page cache */
#define S_DAX (1 << 13) /* Direct Access, avoiding the page cache */
#else
#define S_DAX 0 /* Make all the DAX code disappear */
#define S_DAX 0 /* Make all the DAX code disappear */
#endif
#define S_ENCRYPTED 16384 /* Encrypted file (using fs/crypto/) */
#define S_CASEFOLD 32768 /* Casefolded file */
#define S_VERITY 65536 /* Verity file (using fs/verity/) */
#define S_ENCRYPTED (1 << 14) /* Encrypted file (using fs/crypto/) */
#define S_CASEFOLD (1 << 15) /* Casefolded file */
#define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */

/*
* Note that nosuid etc flags are inode-specific: setting some file-system
Expand Down
1 change: 1 addition & 0 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
SKB_DATA_ALIGN(sizeof(struct sk_buff)) + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))

struct ahash_request;
struct net_device;
struct scatterlist;
struct pipe_inode_info;
Expand Down
1 change: 1 addition & 0 deletions include/linux/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/compiler.h> /* __user */
#include <uapi/linux/socket.h>

struct file;
struct pid;
struct cred;
struct socket;
Expand Down
1 change: 0 additions & 1 deletion include/linux/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <linux/kernel.h>
#include <linux/thread_info.h>
#include <crypto/hash.h>
#include <uapi/linux/uio.h>

struct page;
Expand Down
3 changes: 2 additions & 1 deletion lib/iov_iter.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <crypto/hash.h>
#include <linux/export.h>
#include <linux/bvec.h>
#include <linux/uio.h>
Expand Down Expand Up @@ -1567,7 +1568,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter);
size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
struct iov_iter *i)
{
#ifdef CONFIG_CRYPTO
#ifdef CONFIG_CRYPTO_HASH
struct ahash_request *hash = hashp;
struct scatterlist sg;
size_t copied;
Expand Down

0 comments on commit b79675e

Please sign in to comment.