mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branch 'work.aio-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull aio updates from Al Viro:
"Majority of AIO stuff this cycle. aio-fsync and aio-poll, mostly.
The only thing I'm holding back for a day or so is Adam's aio ioprio -
his last-minute fixup is trivial (missing stub in !CONFIG_BLOCK case),
but let it sit in -next for decency sake..."
* 'work.aio-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
aio: sanitize the limit checking in io_submit(2)
aio: fold do_io_submit() into callers
aio: shift copyin of iocb into io_submit_one()
aio_read_events_ring(): make a bit more readable
aio: all callers of aio_{read,write,fsync,poll} treat 0 and -EIOCBQUEUED the same way
aio: take list removal to (some) callers of aio_complete()
aio: add missing break for the IOCB_CMD_FDSYNC case
random: convert to ->poll_mask
timerfd: convert to ->poll_mask
eventfd: switch to ->poll_mask
pipe: convert to ->poll_mask
crypto: af_alg: convert to ->poll_mask
net/rxrpc: convert to ->poll_mask
net/iucv: convert to ->poll_mask
net/phonet: convert to ->poll_mask
net/nfc: convert to ->poll_mask
net/caif: convert to ->poll_mask
net/bluetooth: convert to ->poll_mask
net/sctp: convert to ->poll_mask
net/tipc: convert to ->poll_mask
...
This commit is contained in:
@@ -440,7 +440,9 @@ prototypes:
|
||||
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
|
||||
int (*iterate) (struct file *, struct dir_context *);
|
||||
int (*iterate_shared) (struct file *, struct dir_context *);
|
||||
unsigned int (*poll) (struct file *, struct poll_table_struct *);
|
||||
__poll_t (*poll) (struct file *, struct poll_table_struct *);
|
||||
struct wait_queue_head * (*get_poll_head)(struct file *, __poll_t);
|
||||
__poll_t (*poll_mask) (struct file *, __poll_t);
|
||||
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
int (*mmap) (struct file *, struct vm_area_struct *);
|
||||
@@ -471,7 +473,7 @@ prototypes:
|
||||
};
|
||||
|
||||
locking rules:
|
||||
All may block.
|
||||
All except for ->poll_mask may block.
|
||||
|
||||
->llseek() locking has moved from llseek to the individual llseek
|
||||
implementations. If your fs is not using generic_file_llseek, you
|
||||
@@ -503,6 +505,9 @@ in sys_read() and friends.
|
||||
the lease within the individual filesystem to record the result of the
|
||||
operation
|
||||
|
||||
->poll_mask can be called with or without the waitqueue lock for the waitqueue
|
||||
returned from ->get_poll_head.
|
||||
|
||||
--------------------------- dquot_operations -------------------------------
|
||||
prototypes:
|
||||
int (*write_dquot) (struct dquot *);
|
||||
|
||||
@@ -856,7 +856,9 @@ struct file_operations {
|
||||
ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
|
||||
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
|
||||
int (*iterate) (struct file *, struct dir_context *);
|
||||
unsigned int (*poll) (struct file *, struct poll_table_struct *);
|
||||
__poll_t (*poll) (struct file *, struct poll_table_struct *);
|
||||
struct wait_queue_head * (*get_poll_head)(struct file *, __poll_t);
|
||||
__poll_t (*poll_mask) (struct file *, __poll_t);
|
||||
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
|
||||
int (*mmap) (struct file *, struct vm_area_struct *);
|
||||
@@ -901,6 +903,17 @@ otherwise noted.
|
||||
activity on this file and (optionally) go to sleep until there
|
||||
is activity. Called by the select(2) and poll(2) system calls
|
||||
|
||||
get_poll_head: Returns the struct wait_queue_head that callers can
|
||||
wait on. Callers need to check the returned events using ->poll_mask
|
||||
once woken. Can return NULL to indicate polling is not supported,
|
||||
or any error code using the ERR_PTR convention to indicate that a
|
||||
grave error occured and ->poll_mask shall not be called.
|
||||
|
||||
poll_mask: return the mask of EPOLL* values describing the file descriptor
|
||||
state. Called either before going to sleep on the waitqueue returned by
|
||||
get_poll_head, or after it has been woken. If ->get_poll_head and
|
||||
->poll_mask are implemented ->poll does not need to be implement.
|
||||
|
||||
unlocked_ioctl: called by the ioctl(2) system call.
|
||||
|
||||
compat_ioctl: called by the ioctl(2) system call when 32 bit system calls
|
||||
|
||||
@@ -396,3 +396,4 @@
|
||||
382 i386 pkey_free sys_pkey_free __ia32_sys_pkey_free
|
||||
383 i386 statx sys_statx __ia32_sys_statx
|
||||
384 i386 arch_prctl sys_arch_prctl __ia32_compat_sys_arch_prctl
|
||||
385 i386 io_pgetevents sys_io_pgetevents __ia32_compat_sys_io_pgetevents
|
||||
|
||||
@@ -341,6 +341,7 @@
|
||||
330 common pkey_alloc __x64_sys_pkey_alloc
|
||||
331 common pkey_free __x64_sys_pkey_free
|
||||
332 common statx __x64_sys_statx
|
||||
333 common io_pgetevents __x64_sys_io_pgetevents
|
||||
|
||||
#
|
||||
# x32-specific system call numbers start at 512 to avoid cache impact
|
||||
|
||||
+3
-11
@@ -347,7 +347,6 @@ static const struct proto_ops alg_proto_ops = {
|
||||
.sendpage = sock_no_sendpage,
|
||||
.sendmsg = sock_no_sendmsg,
|
||||
.recvmsg = sock_no_recvmsg,
|
||||
.poll = sock_no_poll,
|
||||
|
||||
.bind = alg_bind,
|
||||
.release = af_alg_release,
|
||||
@@ -1061,19 +1060,12 @@ void af_alg_async_cb(struct crypto_async_request *_req, int err)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(af_alg_async_cb);
|
||||
|
||||
/**
|
||||
* af_alg_poll - poll system call handler
|
||||
*/
|
||||
__poll_t af_alg_poll(struct file *file, struct socket *sock,
|
||||
poll_table *wait)
|
||||
__poll_t af_alg_poll_mask(struct socket *sock, __poll_t events)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct alg_sock *ask = alg_sk(sk);
|
||||
struct af_alg_ctx *ctx = ask->private;
|
||||
__poll_t mask;
|
||||
|
||||
sock_poll_wait(file, sk_sleep(sk), wait);
|
||||
mask = 0;
|
||||
__poll_t mask = 0;
|
||||
|
||||
if (!ctx->more || ctx->used)
|
||||
mask |= EPOLLIN | EPOLLRDNORM;
|
||||
@@ -1083,7 +1075,7 @@ __poll_t af_alg_poll(struct file *file, struct socket *sock,
|
||||
|
||||
return mask;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(af_alg_poll);
|
||||
EXPORT_SYMBOL_GPL(af_alg_poll_mask);
|
||||
|
||||
/**
|
||||
* af_alg_alloc_areq - allocate struct af_alg_async_req
|
||||
|
||||
+2
-2
@@ -375,7 +375,7 @@ static struct proto_ops algif_aead_ops = {
|
||||
.sendmsg = aead_sendmsg,
|
||||
.sendpage = af_alg_sendpage,
|
||||
.recvmsg = aead_recvmsg,
|
||||
.poll = af_alg_poll,
|
||||
.poll_mask = af_alg_poll_mask,
|
||||
};
|
||||
|
||||
static int aead_check_key(struct socket *sock)
|
||||
@@ -471,7 +471,7 @@ static struct proto_ops algif_aead_ops_nokey = {
|
||||
.sendmsg = aead_sendmsg_nokey,
|
||||
.sendpage = aead_sendpage_nokey,
|
||||
.recvmsg = aead_recvmsg_nokey,
|
||||
.poll = af_alg_poll,
|
||||
.poll_mask = af_alg_poll_mask,
|
||||
};
|
||||
|
||||
static void *aead_bind(const char *name, u32 type, u32 mask)
|
||||
|
||||
@@ -288,7 +288,6 @@ static struct proto_ops algif_hash_ops = {
|
||||
.mmap = sock_no_mmap,
|
||||
.bind = sock_no_bind,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
.poll = sock_no_poll,
|
||||
|
||||
.release = af_alg_release,
|
||||
.sendmsg = hash_sendmsg,
|
||||
@@ -396,7 +395,6 @@ static struct proto_ops algif_hash_ops_nokey = {
|
||||
.mmap = sock_no_mmap,
|
||||
.bind = sock_no_bind,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
.poll = sock_no_poll,
|
||||
|
||||
.release = af_alg_release,
|
||||
.sendmsg = hash_sendmsg_nokey,
|
||||
|
||||
@@ -106,7 +106,6 @@ static struct proto_ops algif_rng_ops = {
|
||||
.bind = sock_no_bind,
|
||||
.accept = sock_no_accept,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
.poll = sock_no_poll,
|
||||
.sendmsg = sock_no_sendmsg,
|
||||
.sendpage = sock_no_sendpage,
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ static struct proto_ops algif_skcipher_ops = {
|
||||
.sendmsg = skcipher_sendmsg,
|
||||
.sendpage = af_alg_sendpage,
|
||||
.recvmsg = skcipher_recvmsg,
|
||||
.poll = af_alg_poll,
|
||||
.poll_mask = af_alg_poll_mask,
|
||||
};
|
||||
|
||||
static int skcipher_check_key(struct socket *sock)
|
||||
@@ -301,7 +301,7 @@ static struct proto_ops algif_skcipher_ops_nokey = {
|
||||
.sendmsg = skcipher_sendmsg_nokey,
|
||||
.sendpage = skcipher_sendpage_nokey,
|
||||
.recvmsg = skcipher_recvmsg_nokey,
|
||||
.poll = af_alg_poll,
|
||||
.poll_mask = af_alg_poll_mask,
|
||||
};
|
||||
|
||||
static void *skcipher_bind(const char *name, u32 type, u32 mask)
|
||||
|
||||
+17
-14
@@ -402,8 +402,7 @@ static struct poolinfo {
|
||||
/*
|
||||
* Static global variables
|
||||
*/
|
||||
static DECLARE_WAIT_QUEUE_HEAD(random_read_wait);
|
||||
static DECLARE_WAIT_QUEUE_HEAD(random_write_wait);
|
||||
static DECLARE_WAIT_QUEUE_HEAD(random_wait);
|
||||
static struct fasync_struct *fasync;
|
||||
|
||||
static DEFINE_SPINLOCK(random_ready_list_lock);
|
||||
@@ -722,8 +721,8 @@ retry:
|
||||
|
||||
/* should we wake readers? */
|
||||
if (entropy_bits >= random_read_wakeup_bits &&
|
||||
wq_has_sleeper(&random_read_wait)) {
|
||||
wake_up_interruptible(&random_read_wait);
|
||||
wq_has_sleeper(&random_wait)) {
|
||||
wake_up_interruptible_poll(&random_wait, POLLIN);
|
||||
kill_fasync(&fasync, SIGIO, POLL_IN);
|
||||
}
|
||||
/* If the input pool is getting full, send some
|
||||
@@ -1397,7 +1396,7 @@ retry:
|
||||
trace_debit_entropy(r->name, 8 * ibytes);
|
||||
if (ibytes &&
|
||||
(r->entropy_count >> ENTROPY_SHIFT) < random_write_wakeup_bits) {
|
||||
wake_up_interruptible(&random_write_wait);
|
||||
wake_up_interruptible_poll(&random_wait, POLLOUT);
|
||||
kill_fasync(&fasync, SIGIO, POLL_OUT);
|
||||
}
|
||||
|
||||
@@ -1839,7 +1838,7 @@ _random_read(int nonblock, char __user *buf, size_t nbytes)
|
||||
if (nonblock)
|
||||
return -EAGAIN;
|
||||
|
||||
wait_event_interruptible(random_read_wait,
|
||||
wait_event_interruptible(random_wait,
|
||||
ENTROPY_BITS(&input_pool) >=
|
||||
random_read_wakeup_bits);
|
||||
if (signal_pending(current))
|
||||
@@ -1876,14 +1875,17 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __poll_t
|
||||
random_poll(struct file *file, poll_table * wait)
|
||||
static struct wait_queue_head *
|
||||
random_get_poll_head(struct file *file, __poll_t events)
|
||||
{
|
||||
__poll_t mask;
|
||||
return &random_wait;
|
||||
}
|
||||
|
||||
static __poll_t
|
||||
random_poll_mask(struct file *file, __poll_t events)
|
||||
{
|
||||
__poll_t mask = 0;
|
||||
|
||||
poll_wait(file, &random_read_wait, wait);
|
||||
poll_wait(file, &random_write_wait, wait);
|
||||
mask = 0;
|
||||
if (ENTROPY_BITS(&input_pool) >= random_read_wakeup_bits)
|
||||
mask |= EPOLLIN | EPOLLRDNORM;
|
||||
if (ENTROPY_BITS(&input_pool) < random_write_wakeup_bits)
|
||||
@@ -1990,7 +1992,8 @@ static int random_fasync(int fd, struct file *filp, int on)
|
||||
const struct file_operations random_fops = {
|
||||
.read = random_read,
|
||||
.write = random_write,
|
||||
.poll = random_poll,
|
||||
.get_poll_head = random_get_poll_head,
|
||||
.poll_mask = random_poll_mask,
|
||||
.unlocked_ioctl = random_ioctl,
|
||||
.fasync = random_fasync,
|
||||
.llseek = noop_llseek,
|
||||
@@ -2323,7 +2326,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
|
||||
* We'll be woken up again once below random_write_wakeup_thresh,
|
||||
* or when the calling thread is about to terminate.
|
||||
*/
|
||||
wait_event_interruptible(random_write_wait, kthread_should_stop() ||
|
||||
wait_event_interruptible(random_wait, kthread_should_stop() ||
|
||||
ENTROPY_BITS(&input_pool) <= random_write_wakeup_bits);
|
||||
mix_pool_bytes(poolp, buffer, count);
|
||||
credit_entropy_bits(poolp, entropy);
|
||||
|
||||
@@ -588,7 +588,7 @@ static const struct proto_ops data_sock_ops = {
|
||||
.getname = data_sock_getname,
|
||||
.sendmsg = mISDN_sock_sendmsg,
|
||||
.recvmsg = mISDN_sock_recvmsg,
|
||||
.poll = datagram_poll,
|
||||
.poll_mask = datagram_poll_mask,
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = sock_no_shutdown,
|
||||
.setsockopt = data_sock_setsockopt,
|
||||
@@ -745,7 +745,6 @@ static const struct proto_ops base_sock_ops = {
|
||||
.getname = sock_no_getname,
|
||||
.sendmsg = sock_no_sendmsg,
|
||||
.recvmsg = sock_no_recvmsg,
|
||||
.poll = sock_no_poll,
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = sock_no_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
||||
@@ -1107,7 +1107,7 @@ static const struct proto_ops pppoe_ops = {
|
||||
.socketpair = sock_no_socketpair,
|
||||
.accept = sock_no_accept,
|
||||
.getname = pppoe_getname,
|
||||
.poll = datagram_poll,
|
||||
.poll_mask = datagram_poll_mask,
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = sock_no_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
||||
@@ -624,7 +624,6 @@ static const struct proto_ops pptp_ops = {
|
||||
.socketpair = sock_no_socketpair,
|
||||
.accept = sock_no_accept,
|
||||
.getname = pptp_getname,
|
||||
.poll = sock_no_poll,
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = sock_no_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
||||
@@ -113,7 +113,7 @@ static void serial2002_tty_read_poll_wait(struct file *f, int timeout)
|
||||
long elapsed;
|
||||
__poll_t mask;
|
||||
|
||||
mask = f->f_op->poll(f, &table.pt);
|
||||
mask = vfs_poll(f, &table.pt);
|
||||
if (mask & (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |
|
||||
EPOLLHUP | EPOLLERR)) {
|
||||
break;
|
||||
@@ -136,7 +136,7 @@ static int serial2002_tty_read(struct file *f, int timeout)
|
||||
|
||||
result = -1;
|
||||
if (!IS_ERR(f)) {
|
||||
if (f->f_op->poll) {
|
||||
if (file_can_poll(f)) {
|
||||
serial2002_tty_read_poll_wait(f, timeout);
|
||||
|
||||
if (kernel_read(f, &ch, 1, &pos) == 1)
|
||||
|
||||
@@ -1965,7 +1965,7 @@ static const struct proto_ops ipx_dgram_ops = {
|
||||
.socketpair = sock_no_socketpair,
|
||||
.accept = sock_no_accept,
|
||||
.getname = ipx_getname,
|
||||
.poll = datagram_poll,
|
||||
.poll_mask = datagram_poll_mask,
|
||||
.ioctl = ipx_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = ipx_compat_ioctl,
|
||||
|
||||
@@ -166,7 +166,7 @@ int vfio_virqfd_enable(void *opaque,
|
||||
init_waitqueue_func_entry(&virqfd->wait, virqfd_wakeup);
|
||||
init_poll_funcptr(&virqfd->pt, virqfd_ptable_queue_proc);
|
||||
|
||||
events = irqfd.file->f_op->poll(irqfd.file, &virqfd->pt);
|
||||
events = vfs_poll(irqfd.file, &virqfd->pt);
|
||||
|
||||
/*
|
||||
* Check if there was an event already pending on the eventfd
|
||||
|
||||
@@ -208,7 +208,7 @@ int vhost_poll_start(struct vhost_poll *poll, struct file *file)
|
||||
if (poll->wqh)
|
||||
return 0;
|
||||
|
||||
mask = file->f_op->poll(file, &poll->table);
|
||||
mask = vfs_poll(file, &poll->table);
|
||||
if (mask)
|
||||
vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
|
||||
if (mask & EPOLLERR) {
|
||||
|
||||
+11
-4
@@ -101,14 +101,20 @@ static int eventfd_release(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __poll_t eventfd_poll(struct file *file, poll_table *wait)
|
||||
static struct wait_queue_head *
|
||||
eventfd_get_poll_head(struct file *file, __poll_t events)
|
||||
{
|
||||
struct eventfd_ctx *ctx = file->private_data;
|
||||
|
||||
return &ctx->wqh;
|
||||
}
|
||||
|
||||
static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
|
||||
{
|
||||
struct eventfd_ctx *ctx = file->private_data;
|
||||
__poll_t events = 0;
|
||||
u64 count;
|
||||
|
||||
poll_wait(file, &ctx->wqh, wait);
|
||||
|
||||
/*
|
||||
* All writes to ctx->count occur within ctx->wqh.lock. This read
|
||||
* can be done outside ctx->wqh.lock because we know that poll_wait
|
||||
@@ -305,7 +311,8 @@ static const struct file_operations eventfd_fops = {
|
||||
.show_fdinfo = eventfd_show_fdinfo,
|
||||
#endif
|
||||
.release = eventfd_release,
|
||||
.poll = eventfd_poll,
|
||||
.get_poll_head = eventfd_get_poll_head,
|
||||
.poll_mask = eventfd_poll_mask,
|
||||
.read = eventfd_read,
|
||||
.write = eventfd_write,
|
||||
.llseek = noop_llseek,
|
||||
|
||||
+2
-3
@@ -884,8 +884,7 @@ static __poll_t ep_item_poll(const struct epitem *epi, poll_table *pt,
|
||||
|
||||
pt->_key = epi->event.events;
|
||||
if (!is_file_epoll(epi->ffd.file))
|
||||
return epi->ffd.file->f_op->poll(epi->ffd.file, pt) &
|
||||
epi->event.events;
|
||||
return vfs_poll(epi->ffd.file, pt) & epi->event.events;
|
||||
|
||||
ep = epi->ffd.file->private_data;
|
||||
poll_wait(epi->ffd.file, &ep->poll_wait, pt);
|
||||
@@ -2025,7 +2024,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
|
||||
|
||||
/* The target file descriptor must support poll */
|
||||
error = -EPERM;
|
||||
if (!tf.file->f_op->poll)
|
||||
if (!file_can_poll(tf.file))
|
||||
goto error_tgt_fput;
|
||||
|
||||
/* Check if EPOLLWAKEUP is allowed */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user