diff --git a/fs/pnode.h b/fs/pnode.h index f249be2fee7a22d0d6056c526f385b5550751b17..973c3f825e7dcdb8f7fd6b3158df93f6afb9f7fc 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -35,4 +35,5 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, struct list_head *); int propagate_umount(struct list_head *); int propagate_mount_busy(struct vfsmount *, int); +void mnt_release_group_id(struct vfsmount *); #endif /* _LINUX_PNODE_H */ diff --git a/fs/seq_file.c b/fs/seq_file.c index 853770274f200ae36b49929b2afe55368ec1c047..bf2bcfd4bcfb8a9f8e0ce12afd0487c4a47472ad 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -25,6 +25,7 @@ * into the buffer. In case of error ->start() and ->next() return * ERR_PTR(error). In the end of sequence they return %NULL. ->show() * returns 0 in case of success and negative number in case of error. + * Returning SEQ_SKIP means "discard this element and move on". */ int seq_open(struct file *file, const struct seq_operations *op) { @@ -114,8 +115,10 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) if (!p || IS_ERR(p)) break; err = m->op->show(m, p); - if (err) + if (err < 0) break; + if (unlikely(err)) + m->count = 0; if (m->count < m->size) goto Fill; m->op->stop(m, p); @@ -140,9 +143,10 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) break; } err = m->op->show(m, p); - if (err || m->count == m->size) { + if (m->count == m->size || err) { m->count = offs; - break; + if (likely(err <= 0)) + break; } pos = next; } @@ -199,8 +203,12 @@ static int traverse(struct seq_file *m, loff_t offset) if (IS_ERR(p)) break; error = m->op->show(m, p); - if (error) + if (error < 0) break; + if (unlikely(error)) { + error = 0; + m->count = 0; + } if (m->count == m->size) goto Eoverflow; if (pos + m->count > offset) { diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 1da1e6208a0a645d1804fe310fd20817c6539ca6..d65796dc26d90d204519c1e295dfe031522cd291 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -30,6 +30,8 @@ struct seq_operations { int (*show) (struct seq_file *m, void *v); }; +#define SEQ_SKIP 1 + int seq_open(struct file *, const struct seq_operations *); ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); loff_t seq_lseek(struct file *, loff_t, int);