summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-06-15 10:19:22 -0400
committerDavid Howells <dhowells@redhat.com>2018-06-15 10:27:09 -0400
commit0da0b7fd73e4f20e1a987dfade0b36bb4813cf10 (patch)
treee0b6e920d546fc0dbf0d813418ad3e4b0d61eabe /fs/namei.c
parentc88d5a7fff2ef9aeed8aebb06f59d565693d0634 (diff)
afs: Display manually added cells in dynamic root mount
Alter the dynroot mount so that cells created by manipulation of /proc/fs/afs/cells and /proc/fs/afs/rootcell and by specification of a root cell as a module parameter will cause directories for those cells to be created in the dynamic root superblock for the network namespace[*]. To this end: (1) Only one dynamic root superblock is now created per network namespace and this is shared between all attempts to mount it. This makes it easier to find the superblock to modify. (2) When a dynamic root superblock is created, the list of cells is walked and directories created for each cell already defined. (3) When a new cell is added, if a dynamic root superblock exists, a directory is created for it. (4) When a cell is destroyed, the directory is removed. (5) These directories are created by calling lookup_one_len() on the root dir which automatically creates them if they don't exist. [*] Inasmuch as network namespaces are currently supported here. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 186bd2464fd5..2e0a1c5729f1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2464,6 +2464,35 @@ static int lookup_one_len_common(const char *name, struct dentry *base,
2464} 2464}
2465 2465
2466/** 2466/**
2467 * try_lookup_one_len - filesystem helper to lookup single pathname component
2468 * @name: pathname component to lookup
2469 * @base: base directory to lookup from
2470 * @len: maximum length @len should be interpreted to
2471 *
2472 * Look up a dentry by name in the dcache, returning NULL if it does not
2473 * currently exist. The function does not try to create a dentry.
2474 *
2475 * Note that this routine is purely a helper for filesystem usage and should
2476 * not be called by generic code.
2477 *
2478 * The caller must hold base->i_mutex.
2479 */
2480struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len)
2481{
2482 struct qstr this;
2483 int err;
2484
2485 WARN_ON_ONCE(!inode_is_locked(base->d_inode));
2486
2487 err = lookup_one_len_common(name, base, len, &this);
2488 if (err)
2489 return ERR_PTR(err);
2490
2491 return lookup_dcache(&this, base, 0);
2492}
2493EXPORT_SYMBOL(try_lookup_one_len);
2494
2495/**
2467 * lookup_one_len - filesystem helper to lookup single pathname component 2496 * lookup_one_len - filesystem helper to lookup single pathname component
2468 * @name: pathname component to lookup 2497 * @name: pathname component to lookup
2469 * @base: base directory to lookup from 2498 * @base: base directory to lookup from