* [PATCH] Checkpoint and restore task->fs->umask
@ 2010-07-14 20:10 Dan Smith
[not found] ` <1279138243-25087-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Dan Smith @ 2010-07-14 20:10 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
Without this, a task's umask will likely be different before and after
a c/r cycle. Since the user is able to set their umask to anything
(within reason) this is a rather trivial addition.
Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
fs/checkpoint.c | 18 +++++++++++++-----
include/linux/checkpoint_hdr.h | 1 +
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/fs/checkpoint.c b/fs/checkpoint.c
index 70248b1..08b727f 100644
--- a/fs/checkpoint.c
+++ b/fs/checkpoint.c
@@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr)
h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FS);
if (!h)
return -ENOMEM;
+
+ h->umask = fs->umask;
+
ret = ckpt_write_obj(ctx, &h->h);
ckpt_hdr_put(ctx, h);
if (ret)
@@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name)
static void *restore_fs(struct ckpt_ctx *ctx)
{
struct ckpt_hdr_fs *h;
- struct fs_struct *fs;
+ struct fs_struct *fs = NULL;
char *path;
int ret = 0;
h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_FS);
if (IS_ERR(h))
return ERR_PTR(PTR_ERR(h));
- ckpt_hdr_put(ctx, h);
fs = copy_fs_struct(current->fs);
- if (!fs)
- return ERR_PTR(-ENOMEM);
+ if (!fs) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ fs->umask = h->umask & S_IRWXUGO;
ret = ckpt_read_fname(ctx, &path);
if (ret < 0)
@@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx)
kfree(path);
out:
+ ckpt_hdr_put(ctx, h);
if (ret) {
- free_fs_struct(fs);
+ if (fs)
+ free_fs_struct(fs);
return ERR_PTR(ret);
}
return fs;
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 16b1723..a0eb2bb 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -524,6 +524,7 @@ enum restart_block_type {
/* file system */
struct ckpt_hdr_fs {
struct ckpt_hdr h;
+ __u32 umask;
/* char *fs_root */
/* char *fs_pwd */
} __attribute__((aligned(8)));
--
1.7.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1279138243-25087-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] Checkpoint and restore task->fs->umask [not found] ` <1279138243-25087-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2010-07-16 3:43 ` Serge E. Hallyn [not found] ` <20100716034303.GA29664-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Serge E. Hallyn @ 2010-07-16 3:43 UTC (permalink / raw) To: Dan Smith; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org): > Without this, a task's umask will likely be different before and after > a c/r cycle. Since the user is able to set their umask to anything > (within reason) this is a rather trivial addition. > > Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> Acked-by: Serge E. Hallyn <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org> > --- > fs/checkpoint.c | 18 +++++++++++++----- > include/linux/checkpoint_hdr.h | 1 + > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/fs/checkpoint.c b/fs/checkpoint.c > index 70248b1..08b727f 100644 > --- a/fs/checkpoint.c > +++ b/fs/checkpoint.c > @@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr) > h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FS); > if (!h) > return -ENOMEM; > + > + h->umask = fs->umask; > + > ret = ckpt_write_obj(ctx, &h->h); > ckpt_hdr_put(ctx, h); > if (ret) > @@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name) > static void *restore_fs(struct ckpt_ctx *ctx) > { > struct ckpt_hdr_fs *h; > - struct fs_struct *fs; > + struct fs_struct *fs = NULL; > char *path; > int ret = 0; > > h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_FS); > if (IS_ERR(h)) > return ERR_PTR(PTR_ERR(h)); > - ckpt_hdr_put(ctx, h); > > fs = copy_fs_struct(current->fs); > - if (!fs) > - return ERR_PTR(-ENOMEM); > + if (!fs) { > + ret = -ENOMEM; > + goto out; > + } > + > + fs->umask = h->umask & S_IRWXUGO; > > ret = ckpt_read_fname(ctx, &path); > if (ret < 0) > @@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx) > kfree(path); > > out: > + ckpt_hdr_put(ctx, h); > if (ret) { > - free_fs_struct(fs); > + if (fs) > + free_fs_struct(fs); > return ERR_PTR(ret); > } > return fs; > diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h > index 16b1723..a0eb2bb 100644 > --- a/include/linux/checkpoint_hdr.h > +++ b/include/linux/checkpoint_hdr.h > @@ -524,6 +524,7 @@ enum restart_block_type { > /* file system */ > struct ckpt_hdr_fs { > struct ckpt_hdr h; > + __u32 umask; > /* char *fs_root */ > /* char *fs_pwd */ > } __attribute__((aligned(8))); > -- > 1.7.1.1 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20100716034303.GA29664-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] Checkpoint and restore task->fs->umask [not found] ` <20100716034303.GA29664-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org> @ 2010-07-20 2:46 ` Oren Laadan 0 siblings, 0 replies; 3+ messages in thread From: Oren Laadan @ 2010-07-20 2:46 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg, Dan Smith Acked and pulled into v22-dev, thanks. Oren. On 07/15/2010 11:43 PM, Serge E. Hallyn wrote: > Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org): >> Without this, a task's umask will likely be different before and after >> a c/r cycle. Since the user is able to set their umask to anything >> (within reason) this is a rather trivial addition. >> >> Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> > > Acked-by: Serge E. Hallyn <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org> > >> --- >> fs/checkpoint.c | 18 +++++++++++++----- >> include/linux/checkpoint_hdr.h | 1 + >> 2 files changed, 14 insertions(+), 5 deletions(-) >> >> diff --git a/fs/checkpoint.c b/fs/checkpoint.c >> index 70248b1..08b727f 100644 >> --- a/fs/checkpoint.c >> +++ b/fs/checkpoint.c >> @@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr) >> h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FS); >> if (!h) >> return -ENOMEM; >> + >> + h->umask = fs->umask; >> + >> ret = ckpt_write_obj(ctx, &h->h); >> ckpt_hdr_put(ctx, h); >> if (ret) >> @@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name) >> static void *restore_fs(struct ckpt_ctx *ctx) >> { >> struct ckpt_hdr_fs *h; >> - struct fs_struct *fs; >> + struct fs_struct *fs = NULL; >> char *path; >> int ret = 0; >> >> h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_FS); >> if (IS_ERR(h)) >> return ERR_PTR(PTR_ERR(h)); >> - ckpt_hdr_put(ctx, h); >> >> fs = copy_fs_struct(current->fs); >> - if (!fs) >> - return ERR_PTR(-ENOMEM); >> + if (!fs) { >> + ret = -ENOMEM; >> + goto out; >> + } >> + >> + fs->umask = h->umask & S_IRWXUGO; >> >> ret = ckpt_read_fname(ctx, &path); >> if (ret < 0) >> @@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx) >> kfree(path); >> >> out: >> + ckpt_hdr_put(ctx, h); >> if (ret) { >> - free_fs_struct(fs); >> + if (fs) >> + free_fs_struct(fs); >> return ERR_PTR(ret); >> } >> return fs; >> diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h >> index 16b1723..a0eb2bb 100644 >> --- a/include/linux/checkpoint_hdr.h >> +++ b/include/linux/checkpoint_hdr.h >> @@ -524,6 +524,7 @@ enum restart_block_type { >> /* file system */ >> struct ckpt_hdr_fs { >> struct ckpt_hdr h; >> + __u32 umask; >> /* char *fs_root */ >> /* char *fs_pwd */ >> } __attribute__((aligned(8))); >> -- >> 1.7.1.1 >> >> _______________________________________________ >> Containers mailing list >> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org >> https://lists.linux-foundation.org/mailman/listinfo/containers > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-20 2:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-14 20:10 [PATCH] Checkpoint and restore task->fs->umask Dan Smith
[not found] ` <1279138243-25087-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-07-16 3:43 ` Serge E. Hallyn
[not found] ` <20100716034303.GA29664-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2010-07-20 2:46 ` Oren Laadan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.