Commit 9f5596af44514f99e3a654a4f7cb813354b9e516

Authored by Al Viro
1 parent e21e7095a7

take check for new events in namespace (guts of mounts_poll()) to namespace.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 3 changed files with 18 additions and 8 deletions Side-by-side Diff

... ... @@ -737,6 +737,21 @@
737 737 up_read(&namespace_sem);
738 738 }
739 739  
  740 +int mnt_had_events(struct proc_mounts *p)
  741 +{
  742 + struct mnt_namespace *ns = p->ns;
  743 + int res = 0;
  744 +
  745 + spin_lock(&vfsmount_lock);
  746 + if (p->event != ns->event) {
  747 + p->event = ns->event;
  748 + res = 1;
  749 + }
  750 + spin_unlock(&vfsmount_lock);
  751 +
  752 + return res;
  753 +}
  754 +
740 755 struct proc_fs_info {
741 756 int flag;
742 757 const char *str;
... ... @@ -647,17 +647,11 @@
647 647 static unsigned mounts_poll(struct file *file, poll_table *wait)
648 648 {
649 649 struct proc_mounts *p = file->private_data;
650   - struct mnt_namespace *ns = p->ns;
651 650 unsigned res = POLLIN | POLLRDNORM;
652 651  
653   - poll_wait(file, &ns->poll, wait);
654   -
655   - spin_lock(&vfsmount_lock);
656   - if (p->event != ns->event) {
657   - p->event = ns->event;
  652 + poll_wait(file, &p->ns->poll, wait);
  653 + if (mnt_had_events(p))
658 654 res |= POLLERR | POLLPRI;
659   - }
660   - spin_unlock(&vfsmount_lock);
661 655  
662 656 return res;
663 657 }
include/linux/mnt_namespace.h
... ... @@ -35,6 +35,7 @@
35 35 extern const struct seq_operations mounts_op;
36 36 extern const struct seq_operations mountinfo_op;
37 37 extern const struct seq_operations mountstats_op;
  38 +extern int mnt_had_events(struct proc_mounts *);
38 39  
39 40 #endif
40 41 #endif