summaryrefslogtreecommitdiffstats
path: root/fs/kernfs/file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 13:31:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 13:31:36 -0500
commit8dcd175bc3d50b78413c56d5b17d4bddd77412ef (patch)
tree2c2fb25759b43f2e73830f07ef3b444d76825280 /fs/kernfs/file.c
parentafe6fe7036c6efdcb46cabc64bec9b6e4a005210 (diff)
parentfff04900ea79915939ef6a3aad78fca6511a3034 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: - a few misc things - ocfs2 updates - most of MM * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (159 commits) tools/testing/selftests/proc/proc-self-syscall.c: remove duplicate include proc: more robust bulk read test proc: test /proc/*/maps, smaps, smaps_rollup, statm proc: use seq_puts() everywhere proc: read kernel cpu stat pointer once proc: remove unused argument in proc_pid_lookup() fs/proc/thread_self.c: code cleanup for proc_setup_thread_self() fs/proc/self.c: code cleanup for proc_setup_self() proc: return exit code 4 for skipped tests mm,mremap: bail out earlier in mremap_to under map pressure mm/sparse: fix a bad comparison mm/memory.c: do_fault: avoid usage of stale vm_area_struct writeback: fix inode cgroup switching comment mm/huge_memory.c: fix "orig_pud" set but not used mm/hotplug: fix an imbalance with DEBUG_PAGEALLOC mm/memcontrol.c: fix bad line in comment mm/cma.c: cma_declare_contiguous: correct err handling mm/page_ext.c: fix an imbalance with kmemleak mm/compaction: pass pgdat to too_many_isolated() instead of zone mm: remove zone_lru_lock() function, access ->lru_lock directly ...
Diffstat (limited to 'fs/kernfs/file.c')
-rw-r--r--fs/kernfs/file.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index f8d5021a652e..ae948aaa4c53 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -832,26 +832,35 @@ void kernfs_drain_open_files(struct kernfs_node *kn)
832 * to see if it supports poll (Neither 'poll' nor 'select' return 832 * to see if it supports poll (Neither 'poll' nor 'select' return
833 * an appropriate error code). When in doubt, set a suitable timeout value. 833 * an appropriate error code). When in doubt, set a suitable timeout value.
834 */ 834 */
835__poll_t kernfs_generic_poll(struct kernfs_open_file *of, poll_table *wait)
836{
837 struct kernfs_node *kn = kernfs_dentry_node(of->file->f_path.dentry);
838 struct kernfs_open_node *on = kn->attr.open;
839
840 poll_wait(of->file, &on->poll, wait);
841
842 if (of->event != atomic_read(&on->event))
843 return DEFAULT_POLLMASK|EPOLLERR|EPOLLPRI;
844
845 return DEFAULT_POLLMASK;
846}
847
835static __poll_t kernfs_fop_poll(struct file *filp, poll_table *wait) 848static __poll_t kernfs_fop_poll(struct file *filp, poll_table *wait)
836{ 849{
837 struct kernfs_open_file *of = kernfs_of(filp); 850 struct kernfs_open_file *of = kernfs_of(filp);
838 struct kernfs_node *kn = kernfs_dentry_node(filp->f_path.dentry); 851 struct kernfs_node *kn = kernfs_dentry_node(filp->f_path.dentry);
839 struct kernfs_open_node *on = kn->attr.open; 852 __poll_t ret;
840 853
841 if (!kernfs_get_active(kn)) 854 if (!kernfs_get_active(kn))
842 goto trigger; 855 return DEFAULT_POLLMASK|EPOLLERR|EPOLLPRI;
843 856
844 poll_wait(filp, &on->poll, wait); 857 if (kn->attr.ops->poll)
858 ret = kn->attr.ops->poll(of, wait);
859 else
860 ret = kernfs_generic_poll(of, wait);
845 861
846 kernfs_put_active(kn); 862 kernfs_put_active(kn);
847 863 return ret;
848 if (of->event != atomic_read(&on->event))
849 goto trigger;
850
851 return DEFAULT_POLLMASK;
852
853 trigger:
854 return DEFAULT_POLLMASK|EPOLLERR|EPOLLPRI;
855} 864}
856 865
857static void kernfs_notify_workfn(struct work_struct *work) 866static void kernfs_notify_workfn(struct work_struct *work)