diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cachefiles/daemon.c | 6 | ||||
-rw-r--r-- | fs/cifs/cifs_debug.c | 9 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 4 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.h | 114 | ||||
-rw-r--r-- | fs/cifs/smbdirect.c | 16 | ||||
-rw-r--r-- | fs/coda/psdev.c | 6 | ||||
-rw-r--r-- | fs/debugfs/file.c | 4 | ||||
-rw-r--r-- | fs/dlm/plock.c | 2 | ||||
-rw-r--r-- | fs/dlm/user.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/miscdev.c | 2 | ||||
-rw-r--r-- | fs/eventfd.c | 18 | ||||
-rw-r--r-- | fs/eventpoll.c | 63 | ||||
-rw-r--r-- | fs/fcntl.c | 14 | ||||
-rw-r--r-- | fs/fuse/dev.c | 8 | ||||
-rw-r--r-- | fs/fuse/file.c | 2 | ||||
-rw-r--r-- | fs/gfs2/bmap.c | 43 | ||||
-rw-r--r-- | fs/kernfs/file.c | 6 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 2 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/dlmfs/dlmfs.c | 6 | ||||
-rw-r--r-- | fs/orangefs/devorangefs-req.c | 2 | ||||
-rw-r--r-- | fs/pipe.c | 22 | ||||
-rw-r--r-- | fs/proc/kmsg.c | 2 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 4 | ||||
-rw-r--r-- | fs/proc_namespace.c | 4 | ||||
-rw-r--r-- | fs/select.c | 10 | ||||
-rw-r--r-- | fs/seq_file.c | 5 | ||||
-rw-r--r-- | fs/signalfd.c | 4 | ||||
-rw-r--r-- | fs/timerfd.c | 2 | ||||
-rw-r--r-- | fs/userfaultfd.c | 16 |
30 files changed, 264 insertions, 136 deletions
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 7edbd06..3fdee21 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c @@ -289,7 +289,7 @@ found_command: /* * poll for culling state - * - use POLLOUT to indicate culling state + * - use EPOLLOUT to indicate culling state */ static __poll_t cachefiles_daemon_poll(struct file *file, struct poll_table_struct *poll) @@ -301,10 +301,10 @@ static __poll_t cachefiles_daemon_poll(struct file *file, mask = 0; if (test_bit(CACHEFILES_STATE_CHANGED, &cache->flags)) - mask |= POLLIN; + mask |= EPOLLIN; if (test_bit(CACHEFILES_CULLING, &cache->flags)) - mask |= POLLOUT; + mask |= EPOLLOUT; return mask; } diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index c7a8632..e35e711 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -128,6 +128,10 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon) seq_puts(m, " type: CDROM "); else seq_printf(m, " type: %d ", dev_type); + if (tcon->seal) + seq_printf(m, " Encrypted"); + if (tcon->unix_ext) + seq_printf(m, " POSIX Extensions"); if (tcon->ses->server->ops->dump_share_caps) tcon->ses->server->ops->dump_share_caps(m, tcon); @@ -246,7 +250,10 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) atomic_read(&server->smbd_conn->mr_used_count)); skip_rdma: #endif - seq_printf(m, "\nNumber of credits: %d", server->credits); + seq_printf(m, "\nNumber of credits: %d Dialect 0x%x", + server->credits, server->dialect); + if (server->sign) + seq_printf(m, " signed"); i++; list_for_each(tmp2, &server->smb_ses_list) { ses = list_entry(tmp2, struct cifs_ses, diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4e0922d..9ceebf3 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -6343,9 +6343,7 @@ SetEARetry: pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_EA); - parm_data = - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset; pSMB->ParameterOffset = cpu_to_le16(param_offset); pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 6eb9f96..2a2b34c 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -192,6 +192,35 @@ struct smb2_symlink_err_rsp { __u8 PathBuffer[0]; } __packed; +/* SMB 3.1.1 and later dialects. See MS-SMB2 section 2.2.2.1 */ +struct smb2_error_context_rsp { + __le32 ErrorDataLength; + __le32 ErrorId; + __u8 ErrorContextData; /* ErrorDataLength long array */ +} __packed; + +/* Defines for Type field below (see MS-SMB2 2.2.2.2.2.1) */ +#define MOVE_DST_IPADDR_V4 cpu_to_le32(0x00000001) +#define MOVE_DST_IPADDR_V6 cpu_to_le32(0x00000002) + +struct move_dst_ipaddr { + __le32 Type; + __u32 Reserved; + __u8 address[16]; /* IPv4 followed by 12 bytes rsvd or IPv6 address */ +} __packed; + +struct share_redirect_error_context_rsp { + __le32 StructureSize; + __le32 NotificationType; + __le32 ResourceNameOffset; + __le32 ResourceNameLength; + __le16 Flags; + __le16 TargetType; + __le32 IPAddrCount; + struct move_dst_ipaddr IpAddrMoveList[0]; + /* __u8 ResourceName[] */ /* Name of share as counted Unicode string */ +} __packed; + #define SMB2_CLIENT_GUID_SIZE 16 struct smb2_negotiate_req { @@ -320,7 +349,9 @@ struct smb2_logoff_rsp { } __packed; /* Flags/Reserved for SMB3.1.1 */ -#define SMB2_SHAREFLAG_CLUSTER_RECONNECT 0x0001 +#define SMB2_TREE_CONNECT_FLAG_CLUSTER_RECONNECT cpu_to_le16(0x0001) +#define SMB2_TREE_CONNECT_FLAG_REDIRECT_TO_OWNER cpu_to_le16(0x0002) +#define SMB2_TREE_CONNECT_FLAG_EXTENSION_PRESENT cpu_to_le16(0x0004) struct smb2_tree_connect_req { struct smb2_sync_hdr sync_hdr; @@ -331,6 +362,82 @@ struct smb2_tree_connect_req { __u8 Buffer[1]; /* variable length */ } __packed; +/* See MS-SMB2 section 2.2.9.2 */ +/* Context Types */ +#define SMB2_RESERVED_TREE_CONNECT_CONTEXT_ID 0x0000 +#define SMB2_REMOTED_IDENTITY_TREE_CONNECT_CONTEXT_ID cpu_to_le16(0x0001) + +struct tree_connect_contexts { + __le16 ContextType; + __le16 DataLength; + __le32 Reserved; + __u8 Data[0]; +} __packed; + +/* Remoted identity tree connect context structures - see MS-SMB2 2.2.9.2.1 */ +struct smb3_blob_data { + __le16 BlobSize; + __u8 BlobData[0]; +} __packed; + +/* Valid values for Attr */ +#define SE_GROUP_MANDATORY 0x00000001 +#define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002 +#define SE_GROUP_ENABLED 0x00000004 +#define SE_GROUP_OWNER 0x00000008 +#define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010 +#define SE_GROUP_INTEGRITY 0x00000020 +#define SE_GROUP_INTEGRITY_ENABLED 0x00000040 +#define SE_GROUP_RESOURCE 0x20000000 +#define SE_GROUP_LOGON_ID 0xC0000000 + +/* struct sid_attr_data is SidData array in BlobData format then le32 Attr */ + +struct sid_array_data { + __le16 SidAttrCount; + /* SidAttrList - array of sid_attr_data structs */ +} __packed; + +struct luid_attr_data { + +} __packed; + +/* + * struct privilege_data is the same as BLOB_DATA - see MS-SMB2 2.2.9.2.1.5 + * but with size of LUID_ATTR_DATA struct and BlobData set to LUID_ATTR DATA + */ + +struct privilege_array_data { + __le16 PrivilegeCount; + /* array of privilege_data structs */ +} __packed; + +struct remoted_identity_tcon_context { + __le16 TicketType; /* must be 0x0001 */ + __le16 TicketSize; /* total size of this struct */ + __le16 User; /* offset to SID_ATTR_DATA struct with user info */ + __le16 UserName; /* offset to null terminated Unicode username string */ + __le16 Domain; /* offset to null terminated Unicode domain name */ + __le16 Groups; /* offset to SID_ARRAY_DATA struct with group info */ + __le16 RestrictedGroups; /* similar to above */ + __le16 Privileges; /* offset to PRIVILEGE_ARRAY_DATA struct */ + __le16 PrimaryGroup; /* offset to SID_ARRAY_DATA struct */ + __le16 Owner; /* offset to BLOB_DATA struct */ + __le16 DefaultDacl; /* offset to BLOB_DATA struct */ + __le16 DeviceGroups; /* offset to SID_ARRAY_DATA struct */ + __le16 UserClaims; /* offset to BLOB_DATA struct */ + __le16 DeviceClaims; /* offset to BLOB_DATA struct */ + __u8 TicketInfo[0]; /* variable length buf - remoted identity data */ +} __packed; + +struct smb2_tree_connect_req_extension { + __le32 TreeConnectContextOffset; + __le16 TreeConnectContextCount; + __u8 Reserved[10]; + __u8 PathName[0]; /* variable sized array */ + /* followed by array of TreeConnectContexts */ +} __packed; + struct smb2_tree_connect_rsp { struct smb2_hdr hdr; __le16 StructureSize; /* Must be 16 */ @@ -365,7 +472,8 @@ struct smb2_tree_connect_rsp { #define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000 #define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000 #define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000 -#define SHI1005_FLAGS_ALL 0x0000FF33 +#define SMB2_SHAREFLAG_IDENTITY_REMOTING 0x00040000 /* 3.1.1 */ +#define SHI1005_FLAGS_ALL 0x0004FF33 /* Possible share capabilities */ #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */ @@ -373,6 +481,7 @@ struct smb2_tree_connect_rsp { #define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */ #define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */ #define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */ +#define SMB2_SHARE_CAP_REDIRECT_TO_OWNER cpu_to_le32(0x00000100) /* 3.1.1 */ struct smb2_tree_disconnect_req { struct smb2_sync_hdr sync_hdr; @@ -556,6 +665,7 @@ struct create_context { #define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04) #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x02) +#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004) #define SMB2_LEASE_KEY_SIZE 16 diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 5130492..91710eb 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -217,9 +217,10 @@ static void smbd_destroy_rdma_work(struct work_struct *work) spin_unlock_irqrestore( &info->reassembly_queue_lock, flags); put_receive_buffer(info, response); - } + } else + spin_unlock_irqrestore(&info->reassembly_queue_lock, flags); } while (response); - spin_unlock_irqrestore(&info->reassembly_queue_lock, flags); + info->reassembly_data_length = 0; log_rdma_event(INFO, "free receive buffers\n"); @@ -1934,15 +1935,16 @@ again: * No need to lock if we are not at the * end of the queue */ - if (!queue_length) + if (queue_length) + list_del(&response->list); + else { spin_lock_irq( &info->reassembly_queue_lock); - list_del(&response->list); - queue_removed++; - if (!queue_length) + list_del(&response->list); spin_unlock_irq( &info->reassembly_queue_lock); - + } + queue_removed++; info->count_reassembly_queue--; info->count_dequeue_reassembly_queue++; put_receive_buffer(info, response); diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 49d3c6f..c5234c2 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -39,7 +39,7 @@ #include <linux/device.h> #include <linux/pid_namespace.h> #include <asm/io.h> -#include <asm/poll.h> +#include <linux/poll.h> #include <linux/uaccess.h> #include <linux/coda.h> @@ -64,12 +64,12 @@ static struct class *coda_psdev_class; static __poll_t coda_psdev_poll(struct file *file, poll_table * wait) { struct venus_comm *vcp = (struct venus_comm *) file->private_data; - __poll_t mask = POLLOUT | POLLWRNORM; + __poll_t mask = EPOLLOUT | EPOLLWRNORM; poll_wait(file, &vcp->vc_waitq, wait); mutex_lock(&vcp->vc_mutex); if (!list_empty(&vcp->vc_pending)) - mask |= POLLIN | POLLRDNORM; + mask |= EPOLLIN | EPOLLRDNORM; mutex_unlock(&vcp->vc_mutex); return mask; diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 6fdbf21..1f99678 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -18,7 +18,7 @@ #include <linux/slab.h> #include <linux/atomic.h> #include <linux/device.h> -#include <asm/poll.h> +#include <linux/poll.h> #include "internal.h" @@ -214,7 +214,7 @@ static __poll_t full_proxy_poll(struct file *filp, const struct file_operations *real_fops; if (debugfs_file_get(dentry)) - return POLLHUP; + return EPOLLHUP; real_fops = debugfs_real_fops(filp); r = real_fops->poll(filp, wait); diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index a4c63e9..c7d5a2e 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -471,7 +471,7 @@ static __poll_t dev_poll(struct file *file, poll_table *wait) spin_lock(&ops_lock); if (!list_empty(&send_list)) - mask = POLLIN | POLLRDNORM; + mask = EPOLLIN | EPOLLRDNORM; spin_unlock(&ops_lock); return mask; diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 662432a..2a66939 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -896,7 +896,7 @@ static __poll_t device_poll(struct file *file, poll_table *wait) spin_lock(&proc->asts_spin); if (!list_empty(&proc->asts)) { spin_unlock(&proc->asts_spin); - return POLLIN | POLLRDNORM; + return EPOLLIN | EPOLLRDNORM; } spin_unlock(&proc->asts_spin); return 0; diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 7423e79..2d1158e 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c @@ -59,7 +59,7 @@ ecryptfs_miscdev_poll(struct file *file, poll_table *pt) poll_wait(file, &daemon->wait, pt); mutex_lock(&daemon->mux); if (!list_empty(&daemon->msg_ctx_out_queue)) - mask |= POLLIN | POLLRDNORM; + mask |= EPOLLIN | EPOLLRDNORM; out_unlock_daemon: daemon->flags &= ~ECRYPTFS_DAEMON_IN_POLL; mutex_unlock(&daemon->mux); diff --git a/fs/eventfd.c b/fs/eventfd.c index 04fd824..012f5bd 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -45,7 +45,7 @@ struct eventfd_ctx { * * This function is supposed to be called by the kernel in paths that do not * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX - * value, and we signal this as overflow condition by returning a POLLERR + * value, and we signal this as overflow condition by returning a EPOLLERR * to poll(2). * * Returns the amount by which the counter was incremented. This will be less @@ -60,7 +60,7 @@ __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n) n = ULLONG_MAX - ctx->count; ctx->count += n; if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLIN); + wake_up_locked_poll(&ctx->wqh, EPOLLIN); spin_unlock_irqrestore(&ctx->wqh.lock, flags); return n; @@ -96,7 +96,7 @@ static int eventfd_release(struct inode *inode, struct file *file) { struct eventfd_ctx *ctx = file->private_data; - wake_up_poll(&ctx->wqh, POLLHUP); + wake_up_poll(&ctx->wqh, EPOLLHUP); eventfd_ctx_put(ctx); return 0; } @@ -150,11 +150,11 @@ static __poll_t eventfd_poll(struct file *file, poll_table *wait) count = READ_ONCE(ctx->count); if (count > 0) - events |= POLLIN; + events |= EPOLLIN; if (count == ULLONG_MAX) - events |= POLLERR; + events |= EPOLLERR; if (ULLONG_MAX - 1 > count) - events |= POLLOUT; + events |= EPOLLOUT; return events; } @@ -187,7 +187,7 @@ int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *w eventfd_ctx_do_read(ctx, cnt); __remove_wait_queue(&ctx->wqh, wait); if (*cnt != 0 && waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLOUT); + wake_up_locked_poll(&ctx->wqh, EPOLLOUT); spin_unlock_irqrestore(&ctx->wqh.lock, flags); return *cnt != 0 ? 0 : -EAGAIN; @@ -231,7 +231,7 @@ static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count, if (likely(res > 0)) { eventfd_ctx_do_read(ctx, &ucnt); if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLOUT); + wake_up_locked_poll(&ctx->wqh, EPOLLOUT); } spin_unlock_irq(&ctx->wqh.lock); @@ -281,7 +281,7 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c if (likely(res > 0)) { ctx->count += ucnt; if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLIN); + wake_up_locked_poll(&ctx->wqh, EPOLLIN); } spin_unlock_irq(&ctx->wqh.lock); diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 42e35a6..0f3494e 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -95,9 +95,9 @@ /* Epoll private bits inside the event mask */ #define EP_PRIVATE_BITS (EPOLLWAKEUP | EPOLLONESHOT | EPOLLET | EPOLLEXCLUSIVE) -#define EPOLLINOUT_BITS (POLLIN | POLLOUT) +#define EPOLLINOUT_BITS (EPOLLIN | EPOLLOUT) -#define EPOLLEXCLUSIVE_OK_BITS (EPOLLINOUT_BITS | POLLERR | POLLHUP | \ +#define EPOLLEXCLUSIVE_OK_BITS (EPOLLINOUT_BITS | EPOLLERR | EPOLLHUP | \ EPOLLWAKEUP | EPOLLET | EPOLLEXCLUSIVE) /* Maximum number of nesting allowed inside epoll sets */ @@ -260,6 +260,7 @@ struct ep_pqueue { struct ep_send_events_data { int maxevents; struct epoll_event __user *events; + int res; }; /* @@ -554,7 +555,7 @@ static int ep_poll_wakeup_proc(void *priv, void *cookie, int call_nests) wait_queue_head_t *wqueue = (wait_queue_head_t *)cookie; spin_lock_irqsave_nested(&wqueue->lock, flags, call_nests + 1); - wake_up_locked_poll(wqueue, POLLIN); + wake_up_locked_poll(wqueue, EPOLLIN); spin_unlock_irqrestore(&wqueue->lock, flags); return 0; @@ -574,7 +575,7 @@ static void ep_poll_safewake(wait_queue_head_t *wq) static void ep_poll_safewake(wait_queue_head_t *wq) { - wake_up_poll(wq, POLLIN); + wake_up_poll(wq, EPOLLIN); } #endif @@ -660,12 +661,13 @@ static inline void ep_pm_stay_awake_rcu(struct epitem *epi) * * Returns: The same integer error code returned by the @sproc callback. */ -static int ep_scan_ready_list(struct eventpoll *ep, - int (*sproc)(struct eventpoll *, +static __poll_t ep_scan_ready_list(struct eventpoll *ep, + __poll_t (*sproc)(struct eventpoll *, struct list_head *, void *), void *priv, int depth, bool ep_locked) { - int error, pwake = 0; + __poll_t res; + int pwake = 0; unsigned long flags; struct epitem *epi, *nepi; LIST_HEAD(txlist); @@ -694,7 +696,7 @@ static int ep_scan_ready_list(struct eventpoll *ep, /* * Now call the callback function. */ - error = (*sproc)(ep, &txlist, priv); + res = (*sproc)(ep, &txlist, priv); spin_lock_irqsave(&ep->lock, flags); /* @@ -747,7 +749,7 @@ static int ep_scan_ready_list(struct eventpoll *ep, if (pwake) ep_poll_safewake(&ep->poll_wait); - return error; + return res; } static void epi_rcu_free(struct rcu_head *head) @@ -864,7 +866,7 @@ static int ep_eventpoll_release(struct inode *inode, struct file *file) return 0; } -static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, +static __poll_t ep_read_events_proc(struct eventpoll *ep, struct list_head *head, void *priv); static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, poll_table *pt); @@ -874,7 +876,7 @@ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, * the ep->mtx so we need to start from depth=1, such that mutex_lock_nested() * is correctly annotated. */ -static unsigned int ep_item_poll(const struct epitem *epi, poll_table *pt, +static __poll_t ep_item_poll(const struct epitem *epi, poll_table *pt, int depth) { struct eventpoll *ep; @@ -894,7 +896,7 @@ static unsigned int ep_item_poll(const struct epitem *epi, poll_table *pt, locked) & epi->event.events; } -static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, +static __poll_t ep_read_events_proc(struct eventpoll *ep, struct list_head *head, void *priv) { struct epitem *epi, *tmp; @@ -906,7 +908,7 @@ static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, list_for_each_entry_safe(epi, tmp, head, rdllink) { if (ep_item_poll(epi, &pt, depth)) { - return POLLIN | POLLRDNORM; + return EPOLLIN | EPOLLRDNORM; } else { /* * Item has been dropped into the ready list by the poll @@ -1179,12 +1181,12 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v if ((epi->event.events & EPOLLEXCLUSIVE) && !(pollflags & POLLFREE)) { switch (pollflags & EPOLLINOUT_BITS) { - case POLLIN: - if (epi->event.events & POLLIN) + case EPOLLIN: + if (epi->event.events & EPOLLIN) ewake = 1; break; - case POLLOUT: - if (epi->event.events & POLLOUT) + case EPOLLOUT: + if (epi->event.events & EPOLLOUT) ewake = 1; break; case 0: @@ -1414,7 +1416,8 @@ static noinline void ep_destroy_wakeup_source(struct epitem *epi) static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, struct file *tfile, int fd, int full_check) { - int error, revents, pwake = 0; + int error, pwake = 0; + __poll_t revents; unsigned long flags; long user_watches; struct epitem *epi; @@ -1612,12 +1615,11 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, return 0; } -static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, +static __poll_t ep_send_events_proc(struct eventpoll *ep, struct list_head *head, void *priv) { struct ep_send_events_data *esed = priv; - int eventcnt; - unsigned int revents; + __poll_t revents; struct epitem *epi; struct epoll_event __user *uevent; struct wakeup_source *ws; @@ -1630,8 +1632,8 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, * Items cannot vanish during the loop because ep_scan_ready_list() is * holding "mtx" during this call. */ - for (eventcnt = 0, uevent = esed->events; - !list_empty(head) && eventcnt < esed->maxevents;) { + for (esed->res = 0, uevent = esed->events; + !list_empty(head) && esed->res < esed->maxevents;) { epi = list_first_entry(head, struct epitem, rdllink); /* @@ -1665,9 +1667,11 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, __put_user(epi->event.data, &uevent->data)) { list_add(&epi->rdllink, head); ep_pm_stay_awake(epi); - return eventcnt ? eventcnt : -EFAULT; + if (!esed->res) + esed->res = -EFAULT; + return 0; } - eventcnt++; + esed->res++; uevent++; if (epi->event.events & EPOLLONESHOT) epi->event.events &= EP_PRIVATE_BITS; @@ -1689,7 +1693,7 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, } } - return eventcnt; + return 0; } static int ep_send_events(struct eventpoll *ep, @@ -1700,7 +1704,8 @@ static int ep_send_events(struct eventpoll *ep, esed.maxevents = maxevents; esed.events = events; - return ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0, false); + ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0, false); + return esed.res; } static inline struct timespec64 ep_set_mstimeout(long ms) @@ -2100,7 +2105,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, switch (op) { case EPOLL_CTL_ADD: if (!epi) { - epds.events |= POLLERR | POLLHUP; + epds.events |= EPOLLERR | EPOLLHUP; error = ep_insert(ep, &epds, tf.file, fd, full_check); } else error = -EEXIST; @@ -2116,7 +2121,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, case EPOLL_CTL_MOD: if (epi) { if (!(epi->event.events & EPOLLEXCLUSIVE)) { - epds.events |= POLLERR | POLLHUP; + epds.events |= EPOLLERR | EPOLLHUP; error = ep_modify(ep, epi, &epds); } } else @@ -26,7 +26,7 @@ #include <linux/shmem_fs.h> #include <linux/compat.h> -#include <asm/poll.h> +#include <linux/poll.h> #include <asm/siginfo.h> #include <linux/uaccess.h> @@ -691,12 +691,12 @@ COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, /* Table to convert sigio signal codes into poll band bitmaps */ static const __poll_t band_table[NSIGPOLL] = { - POLLIN | POLLRDNORM, /* POLL_IN */ - POLLOUT | POLLWRNORM | POLLWRBAND, /* POLL_OUT */ - POLLIN | POLLRDNORM | POLLMSG, /* POLL_MSG */ - POLLERR, /* POLL_ERR */ - POLLPRI | POLLRDBAND, /* POLL_PRI */ - POLLHUP | POLLERR /* POLL_HUP */ + EPOLLIN | EPOLLRDNORM, /* POLL_IN */ + EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND, /* POLL_OUT */ + EPOLLIN | EPOLLRDNORM | EPOLLMSG, /* POLL_MSG */ + EPOLLERR, /* POLL_ERR */ + EPOLLPRI | EPOLLRDBAND, /* POLL_PRI */ + EPOLLHUP | EPOLLERR /* POLL_HUP */ }; static inline int sigio_perm(struct task_struct *p, diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index aa089a6..5d06384 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2006,21 +2006,21 @@ out: static __poll_t fuse_dev_poll(struct file *file, poll_table *wait) { - __poll_t mask = POLLOUT | POLLWRNORM; + __poll_t mask = EPOLLOUT | EPOLLWRNORM; struct fuse_iqueue *fiq; struct fuse_dev *fud = fuse_get_dev(file); if (!fud) - return POLLERR; + return EPOLLERR; fiq = &fud->fc->iq; poll_wait(file, &fiq->waitq, wait); spin_lock(&fiq->waitq.lock); if (!fiq->connected) - mask = POLLERR; + mask = EPOLLERR; else if (request_pending(fiq)) - mask |= POLLIN | POLLRDNORM; + mask |= EPOLLIN | EPOLLRDNORM; spin_unlock(&fiq->waitq.lock); return mask; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e85e974..a201fb0 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2791,7 +2791,7 @@ __poll_t fuse_file_poll(struct file *file, poll_table *wait) fc->no_poll = 1; return DEFAULT_POLLMASK; } - return POLLERR; + return EPOLLERR; } EXPORT_SYMBOL_GPL(fuse_file_poll); diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 8686379..86d6a44 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -716,7 +716,7 @@ int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, __be64 *ptr; sector_t lblock; sector_t lend; - int ret; + int ret = 0; int eob; unsigned int len; struct buffer_head *bh; @@ -728,12 +728,14 @@ int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, goto out; } - if ((flags & IOMAP_REPORT) && gfs2_is_stuffed(ip)) { - gfs2_stuffed_iomap(inode, iomap); - if (pos >= iomap->length) - return -ENOENT; - ret = 0; - goto out; + if (gfs2_is_stuffed(ip)) { + if (flags & IOMAP_REPORT) { + gfs2_stuffed_iomap(inode, iomap); + if (pos >= iomap->length) + ret = -ENOENT; + goto out; + } + BUG_ON(!(flags & IOMAP_WRITE)); } lblock = pos >> inode->i_blkbits; @@ -744,7 +746,7 @@ int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, iomap->type = IOMAP_HOLE; iomap->length = (u64)(lend - lblock) << inode->i_blkbits; iomap->flags = IOMAP_F_MERGED; - bmap_lock(ip, 0); + bmap_lock(ip, flags & IOMAP_WRITE); /* * Directory data blocks have a struct gfs2_meta_header header, so the @@ -787,27 +789,28 @@ int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, iomap->flags |= IOMAP_F_BOUNDARY; iomap->length = (u64)len << inode->i_blkbits; - ret = 0; - out_release: release_metapath(&mp); - bmap_unlock(ip, 0); + bmap_unlock(ip, flags & IOMAP_WRITE); out: trace_gfs2_iomap_end(ip, iomap, ret); return ret; do_alloc: - if (!(flags & IOMAP_WRITE)) { - if (pos >= i_size_read(inode)) { + if (flags & IOMAP_WRITE) { + ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); + } else if (flags & IOMAP_REPORT) { + loff_t size = i_size_read(inode); + if (pos >= size) ret = -ENOENT; - goto out_release; - } - ret = 0; - iomap->length = hole_size(inode, lblock, &mp); - goto out_release; + else if (height <= ip->i_height) + iomap->length = hole_size(inode, lblock, &mp); + else + iomap->length = size - pos; + } else { + if (height <= ip->i_height) + iomap->length = hole_size(inode, lblock, &mp); } - - ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); goto out_release; } diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index c53d9cc..fd5ce88 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -275,7 +275,7 @@ static ssize_t kernfs_fop_write(struct file *file, const char __user *user_buf, { struct kernfs_open_file *of = kernfs_of(file); const struct kernfs_ops *ops; - size_t len; + ssize_t len; char *buf; if (of->atomic_write_len) { @@ -823,7 +823,7 @@ void kernfs_drain_open_files(struct kernfs_node *kn) * the content and then you use 'poll' or 'select' to wait for * the content to change. When the content changes (assuming the * manager for the kobject supports notification), poll will - * return POLLERR|POLLPRI, and select will return the fd whether + * return EPOLLERR|EPOLLPRI, and select will return the fd whether * it is waiting for read, write, or exceptions. * Once poll/select indicates that the value has changed, you * need to close and re-open the file, or seek to 0 and read again. @@ -851,7 +851,7 @@ static __poll_t kernfs_fop_poll(struct file *filp, poll_table *wait) return DEFAULT_POLLMASK; trigger: - return DEFAULT_POLLMASK|POLLERR|POLLPRI; + return DEFAULT_POLLMASK|EPOLLERR|EPOLLPRI; } static void kernfs_notify_workfn(struct work_struct *work) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index ef08d64..c07eb3d 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -247,7 +247,7 @@ static __poll_t fanotify_poll(struct file *file, poll_table *wait) poll_wait(file, &group->notification_waitq, wait); spin_lock(&group->notification_lock); if (!fsnotify_notify_queue_is_empty(group)) - ret = POLLIN | POLLRDNORM; + ret = EPOLLIN | EPOLLRDNORM; spin_unlock(&group->notification_lock); return ret; diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 5c29bf1..2c908b3 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -115,7 +115,7 @@ static __poll_t inotify_poll(struct file *file, poll_table *wait) poll_wait(file, &group->notification_waitq, wait); spin_lock(&group->notification_lock); if (!fsnotify_notify_queue_is_empty(group)) - ret = POLLIN | POLLRDNORM; + ret = EPOLLIN | EPOLLRDNORM; spin_unlock(&group->notification_lock); return ret; diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 385fcef..602c71f 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c @@ -71,7 +71,7 @@ struct workqueue_struct *user_dlm_worker; * Over time, dlmfs has added some features that were not part of the * initial ABI. Unfortunately, some of these features are not detectable * via standard usage. For example, Linux's default poll always returns - * POLLIN, so there is no way for a caller of poll(2) to know when dlmfs + * EPOLLIN, so there is no way for a caller of poll(2) to know when dlmfs * added poll support. Instead, we provide this list of new capabilities. * * Capabilities is a read-only attribute. We do it as a module parameter @@ -83,7 +83,7 @@ struct workqueue_struct *user_dlm_worker; * interaction. * * Capabilities: - * - bast : POLLIN against the file descriptor of a held lock + * - bast : EPOLLIN against the file descriptor of a held lock * signifies a bast fired on the lock. */ #define DLMFS_CAPABILITIES "bast stackglue" @@ -230,7 +230,7 @@ static __poll_t dlmfs_file_poll(struct file *file, poll_table *wait) spin_lock(&ip->ip_lockres.l_lock); if (ip->ip_lockres.l_flags & USER_LOCK_BLOCKED) - event = POLLIN | POLLRDNORM; + event = EPOLLIN | EPOLLRDNORM; spin_unlock(&ip->ip_lockres.l_lock); return event; diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index f073cd9..b03057a 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c @@ -823,7 +823,7 @@ static __poll_t orangefs_devreq_poll(struct file *file, poll_wait(file, &orangefs_request_list_waitq, poll_table); if (!list_empty(&orangefs_request_list)) - poll_revent_mask |= POLLIN; + poll_revent_mask |= EPOLLIN; return poll_revent_mask; } @@ -327,7 +327,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to) break; } if (do_wakeup) { - wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT | POLLWRNORM); + wake_up_interruptible_sync_poll(&pipe->wait, EPOLLOUT | EPOLLWRNORM); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } pipe_wait(pipe); @@ -336,7 +336,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to) /* Signal writers asynchronously that there is more room. */ if (do_wakeup) { - wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT | POLLWRNORM); + wake_up_interruptible_sync_poll(&pipe->wait, EPOLLOUT | EPOLLWRNORM); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } if (ret > 0) @@ -463,7 +463,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) break; } if (do_wakeup) { - wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); + wake_up_interruptible_sync_poll(&pipe->wait, EPOLLIN | EPOLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); do_wakeup = 0; } @@ -474,7 +474,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) out: __pipe_unlock(pipe); if (do_wakeup) { - wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); + wake_up_interruptible_sync_poll(&pipe->wait, EPOLLIN | EPOLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); } if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) { @@ -523,19 +523,19 @@ pipe_poll(struct file *filp, poll_table *wait) nrbufs = pipe->nrbufs; mask = 0; if (filp->f_mode & FMODE_READ) { - mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0; + mask = (nrbufs > 0) ? EPOLLIN | EPOLLRDNORM : 0; if (!pipe->writers && filp->f_version != pipe->w_counter) - mask |= POLLHUP; + mask |= EPOLLHUP; } if (filp->f_mode & FMODE_WRITE) { - mask |= (nrbufs < pipe->buffers) ? POLLOUT | POLLWRNORM : 0; + mask |= (nrbufs < pipe->buffers) ? EPOLLOUT | EPOLLWRNORM : 0; /* - * Most Unices do not set POLLERR for FIFOs but on Linux they + * Most Unices do not set EPOLLERR for FIFOs but on Linux they * behave exactly like pipes for poll(). */ if (!pipe->readers) - mask |= POLLERR; + mask |= EPOLLERR; } return mask; @@ -568,7 +568,7 @@ pipe_release(struct inode *inode, struct file *file) pipe->writers--; if (pipe->readers || pipe->writers) { - wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP); + wake_up_interruptible_sync_poll(&pipe->wait, EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM | EPOLLERR | EPOLLHUP); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } @@ -936,7 +936,7 @@ static int fifo_open(struct inode *inode, struct file *filp) if (!is_pipe && !pipe->writers) { if ((filp->f_flags & O_NONBLOCK)) { - /* suppress POLLHUP until we have + /* suppress EPOLLHUP until we have * seen a writer */ filp->f_version = pipe->w_counter; } else { diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c index f0bfb45..4f4a2ab 100644 --- a/fs/proc/kmsg.c +++ b/fs/proc/kmsg.c @@ -44,7 +44,7 @@ static __poll_t kmsg_poll(struct file *file, poll_table *wait) { poll_wait(file, &log_wait, wait); if (do_syslog(SYSLOG_ACTION_SIZE_UNREAD, NULL, 0, SYSLOG_FROM_PROC)) - return POLLIN | POLLRDNORM; + return EPOLLIN | EPOLLRDNORM; return 0; } diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 6332537..c41ab26 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -640,7 +640,7 @@ static __poll_t proc_sys_poll(struct file *filp, poll_table *wait) /* sysctl was unregistered */ if (IS_ERR(head)) - return POLLERR | POLLHUP; + return EPOLLERR | EPOLLHUP; if (!table->proc_handler) goto out; @@ -653,7 +653,7 @@ static __poll_t proc_sys_poll(struct file *filp, poll_table *wait) if (event != atomic_read(&table->poll->event)) { filp->private_data = proc_sys_poll_event(table->poll); - ret = POLLIN | POLLRDNORM | POLLERR | POLLPRI; + ret = EPOLLIN | EPOLLRDNORM | EPOLLERR | EPOLLPRI; } out: diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c index c8528d5..e16fb8f 100644 --- a/fs/proc_namespace.c +++ b/fs/proc_namespace.c @@ -23,7 +23,7 @@ static __poll_t mounts_poll(struct file *file, poll_table *wait) struct seq_file *m = file->private_data; struct proc_mounts *p = m->private; struct mnt_namespace *ns = p->ns; - __poll_t res = POLLIN | POLLRDNORM; + __poll_t res = EPOLLIN | EPOLLRDNORM; int event; poll_wait(file, &p->ns->poll, wait); @@ -31,7 +31,7 @@ static __poll_t mounts_poll(struct file *file, poll_table *wait) event = READ_ONCE(ns->event); if (m->poll_event != event) { m->poll_event = event; - res |= POLLERR | POLLPRI; + res |= EPOLLERR | EPOLLPRI; } return res; diff --git a/fs/select.c b/fs/select.c index ec14171..b6c3625 100644 --- a/fs/select.c +++ b/fs/select.c @@ -432,9 +432,9 @@ get_max: return max; } -#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR) -#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) -#define POLLEX_SET (POLLPRI) +#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN | EPOLLHUP | EPOLLERR) +#define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT | EPOLLERR) +#define POLLEX_SET (EPOLLPRI) static inline void wait_key_set(poll_table *wait, unsigned long in, unsigned long out, unsigned long bit, @@ -814,11 +814,11 @@ static inline __poll_t do_pollfd(struct pollfd *pollfd, poll_table *pwait, fd = pollfd->fd; if (fd >= 0) { struct fd f = fdget(fd); - mask = POLLNVAL; + mask = EPOLLNVAL; if (f.file) { /* userland u16 ->events contains POLL... bitmap */ __poll_t filter = demangle_poll(pollfd->events) | - POLLERR | POLLHUP; + EPOLLERR | EPOLLHUP; mask = DEFAULT_POLLMASK; if (f.file->f_op->poll) { pwait->_key = filter; diff --git a/fs/seq_file.c b/fs/seq_file.c index 4be761c..eea09f6 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -181,8 +181,11 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) * if request is to read from zero offset, reset iterator to first * record as it might have been already advanced by previous requests */ - if (*ppos == 0) + if (*ppos == 0) { m->index = 0; + m->version = 0; + m->count = 0; + } /* Don't assume *ppos is where we left it */ if (unlikely(*ppos != m->read_pos)) { diff --git a/fs/signalfd.c b/fs/signalfd.c index 31e923b..9990957 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -45,7 +45,7 @@ void signalfd_cleanup(struct sighand_struct *sighand) return; /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */ - wake_up_poll(wqh, POLLHUP | POLLFREE); + wake_up_poll(wqh, EPOLLHUP | POLLFREE); } struct signalfd_ctx { @@ -69,7 +69,7 @@ static __poll_t signalfd_poll(struct file *file, poll_table *wait) if (next_signal(¤t->pending, &ctx->sigmask) || next_signal(¤t->signal->shared_pending, &ctx->sigmask)) - events |= POLLIN; + events |= EPOLLIN; spin_unlock_irq(¤t->sighand->siglock); return events; diff --git a/fs/timerfd.c b/fs/timerfd.c index 0510717..cdad49d 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -237,7 +237,7 @@ static __poll_t timerfd_poll(struct file *file, poll_table *wait) spin_lock_irqsave(&ctx->wqh.lock, flags); if (ctx->ticks) - events |= POLLIN; + events |= EPOLLIN; spin_unlock_irqrestore(&ctx->wqh.lock, flags); return events; diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 87a13a7..cec550c 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -483,7 +483,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) if (likely(must_wait && !READ_ONCE(ctx->released) && (return_to_userland ? !signal_pending(current) : !fatal_signal_pending(current)))) { - wake_up_poll(&ctx->fd_wqh, POLLIN); + wake_up_poll(&ctx->fd_wqh, EPOLLIN); schedule(); ret |= VM_FAULT_MAJOR; @@ -614,7 +614,7 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, spin_unlock(&ctx->event_wqh.lock); - wake_up_poll(&ctx->fd_wqh, POLLIN); + wake_up_poll(&ctx->fd_wqh, EPOLLIN); schedule(); spin_lock(&ctx->event_wqh.lock); @@ -904,7 +904,7 @@ wakeup: /* Flush pending events that may still wait on event_wqh */ wake_up_all(&ctx->event_wqh); - wake_up_poll(&ctx->fd_wqh, POLLHUP); + wake_up_poll(&ctx->fd_wqh, EPOLLHUP); userfaultfd_ctx_put(ctx); return 0; } @@ -949,14 +949,14 @@ static __poll_t userfaultfd_poll(struct file *file, poll_table *wait) switch (ctx->state) { case UFFD_STATE_WAIT_API: - return POLLERR; + return EPOLLERR; case UFFD_STATE_RUNNING: /* * poll() never guarantees that read won't block. * userfaults can be waken before they're read(). */ if (unlikely(!(file->f_flags & O_NONBLOCK))) - return POLLERR; + return EPOLLERR; /* * lockless access to see if there are pending faults * __pollwait last action is the add_wait_queue but @@ -970,14 +970,14 @@ static __poll_t userfaultfd_poll(struct file *file, poll_table *wait) ret = 0; smp_mb(); if (waitqueue_active(&ctx->fault_pending_wqh)) - ret = POLLIN; + ret = EPOLLIN; else if (waitqueue_active(&ctx->event_wqh)) - ret = POLLIN; + ret = EPOLLIN; return ret; default: WARN_ON_ONCE(1); - return POLLERR; + return EPOLLERR; } } |