Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Aufs5 Standalone
Commits
3c7357f0
Commit
3c7357f0
authored
May 28, 2019
by
J. R. Okajima
Browse files
aufs5.1 20190603
Signed-off-by:
J. R. Okajima
<
hooanon05g@gmail.com
>
parent
43801864
Changes
3
Show whitespace changes
Inline
Side-by-side
aufs5-loopback.patch
View file @
3c7357f0
...
...
@@ -190,7 +190,7 @@ index 9ba35a878ecd..4ed0ff03d5ab 100644
+ return f;
+}
diff --git a/fs/aufs/loop.h b/fs/aufs/loop.h
index
c42cbe71ed4b..255e2d3763e7
100644
index
f31e40aff267..e13fb1a0717a
100644
--- a/fs/aufs/loop.h
+++ b/fs/aufs/loop.h
@@ -26,6 +26,8 @@
void au_warn_loopback(struct super_block *h_sb);
...
...
@@ -200,7 +200,7 @@ index c42cbe71ed4b..255e2d3763e7 100644
+
+struct file *aufs_real_loop(struct file *file);
#else
AuStub(struct file *, loop_backing_file, return NULL)
AuStub(struct file *, loop_backing_file, return NULL
, struct super_block *sb
)
@@ -36,6 +38,8 @@
AuStubVoid(au_warn_loopback, struct super_block *h_sb)
...
...
include/uapi/linux/aufs_type.h
View file @
3c7357f0
...
...
@@ -40,7 +40,7 @@
#include <linux/limits.h>
#define AUFS_VERSION "5.1-20190
520
"
#define AUFS_VERSION "5.1-20190
603
"
/* todo? move this to linux-2.6.19/include/magic.h */
#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
...
...
proc_mounts.patch
0 → 100644
View file @
3c7357f0
SPDX-License-Identifier: GPL-2.0
diff --git a/fs/mount.h b/fs/mount.h
index 6250de544760..29abfea2db50 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -131,9 +131,7 @@
struct proc_mounts {
struct mnt_namespace *ns;
struct path root;
int (*show)(struct seq_file *, struct vfsmount *);
- void *cached_mount;
- u64 cached_event;
- loff_t cached_index;
+ bool filled;
};
extern const struct seq_operations mounts_op;
diff --git a/fs/namespace.c b/fs/namespace.c
index c9cab307fa77..fbba9c8b542d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1259,46 +1259,78 @@
struct vfsmount *mnt_clone_internal(const struct path *path)
#ifdef CONFIG_PROC_FS
/* iterator; we want it to have access to namespace_sem, thus here... */
-static void *m_start(struct seq_file *m, loff_t *pos)
+static int m_start_fill(struct seq_file *m)
{
+ int err;
+ size_t last_count;
+ char *buf;
+ struct mount *r;
struct proc_mounts *p = m->private;
+ err = -ENODATA;
down_read(&namespace_sem);
- if (p->cached_event == p->ns->event) {
- void *v = p->cached_mount;
- if (*pos == p->cached_index)
- return v;
- if (*pos == p->cached_index + 1) {
- v = seq_list_next(v, &p->ns->list, &p->cached_index);
- return p->cached_mount = v;
+ list_for_each_entry(r, &p->ns->list, mnt_list) {
+ last_count = m->count;
+ err = p->show(m, &r->mnt);
+ if (unlikely(err < 0))
+ break;
+ if (!seq_has_overflowed(m))
+ continue;
+
+ /* expand the buffer */
+ buf = kvmalloc(m->size + PAGE_SIZE, GFP_KERNEL);
+ if (unlikely(!buf)) {
+ err = -ENOMEM;
+ break;
+ }
+ memcpy(buf, m->buf, last_count);
+ kvfree(m->buf);
+ m->buf = buf;
+ m->size += PAGE_SIZE;
+ m->count = last_count;
+
+ err = p->show(m, &r->mnt);
+ if (unlikely(err < 0))
+ break;
+ else if (unlikely(seq_has_overflowed(m))) {
+ err = -EOVERFLOW;
+ break;
}
}
+ up_read(&namespace_sem);
- p->cached_event = p->ns->event;
- p->cached_mount = seq_list_start(&p->ns->list, *pos);
- p->cached_index = *pos;
- return p->cached_mount;
+ if (!err)
+ p->filled = true;
+ return err;
}
-static void *m_next(struct seq_file *m, void *v, loff_t *pos)
+static void *m_start(struct seq_file *m, loff_t *pos)
{
+ int err;
struct proc_mounts *p = m->private;
- p->cached_mount = seq_list_next(v, &p->ns->list, pos);
- p->cached_index = *pos;
- return p->cached_mount;
+ if (!p->filled) {
+ err = m_start_fill(m);
+ if (unlikely(err))
+ return ERR_PTR(err);
+ }
+
+ return m_start; /* any valid pointer */
+}
+
+static void *m_next(struct seq_file *m, void *v, loff_t *pos)
+{
+ return NULL;
}
static void m_stop(struct seq_file *m, void *v)
{
- up_read(&namespace_sem);
+ /* empty */
}
static int m_show(struct seq_file *m, void *v)
{
- struct proc_mounts *p = m->private;
- struct mount *r = list_entry(v, struct mount, mnt_list);
- return p->show(m, &r->mnt);
+ return 0;
}
const struct seq_operations mounts_op = {
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index e16fb8f2049e..268e80d568ce 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -279,7 +279,6 @@
static int mounts_open_common(struct inode *inode, struct file *file,
p->ns = ns;
p->root = root;
p->show = show;
- p->cached_event = ~0ULL;
return 0;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment