Skip to content

Commit 38b0822

Browse files
author
Christoph Hellwig
committed
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 <[email protected]> Acked-by: Linus Torvalds <[email protected]>
1 parent fd5ad30 commit 38b0822

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

init/initramfs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ static inline void __init eat(unsigned n)
202202
byte_count -= n;
203203
}
204204

205-
static __initdata char *vcollected;
206205
static __initdata char *collected;
207206
static long remains __initdata;
208207
static __initdata char *collect;
@@ -345,7 +344,6 @@ static int __init do_name(void)
345344
vfs_fchmod(wfile, mode);
346345
if (body_len)
347346
vfs_truncate(&wfile->f_path, body_len);
348-
vcollected = kstrdup(collected, GFP_KERNEL);
349347
state = CopyFile;
350348
}
351349
} else if (S_ISDIR(mode)) {
@@ -368,11 +366,15 @@ static int __init do_name(void)
368366
static int __init do_copy(void)
369367
{
370368
if (byte_count >= body_len) {
369+
struct timespec64 t[2] = { };
371370
if (xwrite(wfile, victim, body_len, &wfile_pos) != body_len)
372371
error("write error");
372+
373+
t[0].tv_sec = mtime;
374+
t[1].tv_sec = mtime;
375+
vfs_utimes(&wfile->f_path, t);
376+
373377
fput(wfile);
374-
do_utime(vcollected, mtime);
375-
kfree(vcollected);
376378
eat(body_len);
377379
state = SkipIt;
378380
return 0;

0 commit comments

Comments
 (0)