This patch adds the pointer for a relink mount(8) option which specifies a path to a directory within the given filesystem where checkpoint/restart may relink files. If the option is unset then checkpoint/restart tries to use "lost+found". A subsequent patch will enable userspace to set a relink=/foo/bar option when mounting a filesystem. Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx> --- fs/namei.c | 6 ++++-- fs/namespace.c | 6 ++++++ include/linux/fs.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 6dea3b1..fcf35b3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2535,7 +2535,7 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname #ifdef CONFIG_CHECKPOINT /* Path relative to the mounted filesystem's root -- not a "global" root or even a namespace root. The unique_name_count is unique for the entire checkpoint. */ -#define CKPT_RELINKAT_FMT "lost+found/checkpoint-%d/relinked-%u" +#define CKPT_RELINKAT_FMT "%s/checkpoint-%d/relinked-%u" static int checkpoint_fill_relink_fname(struct ckpt_ctx *ctx, struct file *for_file, @@ -2569,7 +2569,9 @@ static int checkpoint_fill_relink_fname(struct ckpt_ctx *ctx, len++; } len += snprintf(tmp, PATH_MAX - len, CKPT_RELINKAT_FMT, - ctx->crid, ++ctx->unique_name_count); + relink_dir_path.mnt->mnt_sb->s_relink_dir ? relink_dir_path.mnt->mnt_sb->s_relink_dir : "lost+found", + ctx->crid, + ++ctx->unique_name_count); relink_dir_pathname[len] = '\0'; *lenp = len; return 0; diff --git a/fs/namespace.c b/fs/namespace.c index 8c83cd3..31fe15f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -810,6 +810,12 @@ static int show_sb_opts(struct seq_file *m, struct super_block *sb) if (sb->s_flags & fs_infop->flag) seq_puts(m, fs_infop->str); } +#ifdef CONFIG_CHECKPOINT + if (sb->s_relink_dir) { + seq_puts(m, ",relink="); + seq_puts(m, sb->s_relink_dir); + } +#endif /* CONFIG_CHECKPOINT */ return security_sb_show_options(m, sb); } diff --git a/include/linux/fs.h b/include/linux/fs.h index af1cb0e..826df6f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1426,6 +1426,8 @@ struct super_block { * generic_show_options() */ char __rcu *s_options; + + char *s_relink_dir; }; extern struct timespec current_fs_time(struct super_block *sb); -- 1.6.3.3 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers