aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index b696e3a0d18f..4198003d7e18 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -28,6 +28,7 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30#include "pnode.h" 30#include "pnode.h"
31#include "internal.h"
31 32
32/* spinlock for vfsmount related operations, inplace of dcache_lock */ 33/* spinlock for vfsmount related operations, inplace of dcache_lock */
33__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock); 34__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);
@@ -320,22 +321,16 @@ EXPORT_SYMBOL(mnt_unpin);
320static void *m_start(struct seq_file *m, loff_t *pos) 321static void *m_start(struct seq_file *m, loff_t *pos)
321{ 322{
322 struct mnt_namespace *n = m->private; 323 struct mnt_namespace *n = m->private;
323 struct list_head *p;
324 loff_t l = *pos;
325 324
326 down_read(&namespace_sem); 325 down_read(&namespace_sem);
327 list_for_each(p, &n->list) 326 return seq_list_start(&n->list, *pos);
328 if (!l--)
329 return list_entry(p, struct vfsmount, mnt_list);
330 return NULL;
331} 327}
332 328
333static void *m_next(struct seq_file *m, void *v, loff_t *pos) 329static void *m_next(struct seq_file *m, void *v, loff_t *pos)
334{ 330{
335 struct mnt_namespace *n = m->private; 331 struct mnt_namespace *n = m->private;
336 struct list_head *p = ((struct vfsmount *)v)->mnt_list.next; 332
337 (*pos)++; 333 return seq_list_next(v, &n->list, pos);
338 return p == &n->list ? NULL : list_entry(p, struct vfsmount, mnt_list);
339} 334}
340 335
341static void m_stop(struct seq_file *m, void *v) 336static void m_stop(struct seq_file *m, void *v)
@@ -350,7 +345,7 @@ static inline void mangle(struct seq_file *m, const char *s)
350 345
351static int show_vfsmnt(struct seq_file *m, void *v) 346static int show_vfsmnt(struct seq_file *m, void *v)
352{ 347{
353 struct vfsmount *mnt = v; 348 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
354 int err = 0; 349 int err = 0;
355 static struct proc_fs_info { 350 static struct proc_fs_info {
356 int flag; 351 int flag;
@@ -405,7 +400,7 @@ struct seq_operations mounts_op = {
405 400
406static int show_vfsstat(struct seq_file *m, void *v) 401static int show_vfsstat(struct seq_file *m, void *v)
407{ 402{
408 struct vfsmount *mnt = v; 403 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
409 int err = 0; 404 int err = 0;
410 405
411 /* device */ 406 /* device */
@@ -1457,7 +1452,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
1457 1452
1458 new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL); 1453 new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);
1459 if (!new_ns) 1454 if (!new_ns)
1460 return NULL; 1455 return ERR_PTR(-ENOMEM);
1461 1456
1462 atomic_set(&new_ns->count, 1); 1457 atomic_set(&new_ns->count, 1);
1463 INIT_LIST_HEAD(&new_ns->list); 1458 INIT_LIST_HEAD(&new_ns->list);
@@ -1471,7 +1466,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
1471 if (!new_ns->root) { 1466 if (!new_ns->root) {
1472 up_write(&namespace_sem); 1467 up_write(&namespace_sem);
1473 kfree(new_ns); 1468 kfree(new_ns);
1474 return NULL; 1469 return ERR_PTR(-ENOMEM);;
1475 } 1470 }
1476 spin_lock(&vfsmount_lock); 1471 spin_lock(&vfsmount_lock);
1477 list_add_tail(&new_ns->list, &new_ns->root->mnt_list); 1472 list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
@@ -1515,7 +1510,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
1515 return new_ns; 1510 return new_ns;
1516} 1511}
1517 1512
1518struct mnt_namespace *copy_mnt_ns(int flags, struct mnt_namespace *ns, 1513struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
1519 struct fs_struct *new_fs) 1514 struct fs_struct *new_fs)
1520{ 1515{
1521 struct mnt_namespace *new_ns; 1516 struct mnt_namespace *new_ns;