summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-30 09:19:00 +0300
committerChristoph Hellwig <hch@lst.de>2020-07-31 09:16:01 +0300
commit38b082236e77d403fed23ac2d30d570598744ec3 (patch)
tree2e094e17cb721d34c0a2c944460aee62861afca4 /init
parentfd5ad30c782351ab4d4a15941fc61e743a1bd66c (diff)
downloadlinux-38b082236e77d403fed23ac2d30d570598744ec3.tar.xz
initramfs: use vfs_utimes in do_copy
Don't bother saving away the pathname and just use the new struct path based utimes helper instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/initramfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 35c26668d463..9820fca4d4e3 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -202,7 +202,6 @@ static inline void __init eat(unsigned n)
byte_count -= n;
}
-static __initdata char *vcollected;
static __initdata char *collected;
static long remains __initdata;
static __initdata char *collect;
@@ -345,7 +344,6 @@ static int __init do_name(void)
vfs_fchmod(wfile, mode);
if (body_len)
vfs_truncate(&wfile->f_path, body_len);
- vcollected = kstrdup(collected, GFP_KERNEL);
state = CopyFile;
}
} else if (S_ISDIR(mode)) {
@@ -368,11 +366,15 @@ static int __init do_name(void)
static int __init do_copy(void)
{
if (byte_count >= body_len) {
+ struct timespec64 t[2] = { };
if (xwrite(wfile, victim, body_len, &wfile_pos) != body_len)
error("write error");
+
+ t[0].tv_sec = mtime;
+ t[1].tv_sec = mtime;
+ vfs_utimes(&wfile->f_path, t);
+
fput(wfile);
- do_utime(vcollected, mtime);
- kfree(vcollected);
eat(body_len);
state = SkipIt;
return 0;