Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

do_utimes_path(): import pathname only once

Convert the user_path_at() call inside a retry loop into getname_flags() +
filename_lookup() + putname() and leave only filename_lookup() inside
the loop.

Since we have the default logics for use of LOOKUP_EMPTY (passed iff
AT_EMPTY_PATH is present in flags), just use getname_uflags() and
don't bother with setting LOOKUP_EMPTY in lookup_flags - getname_uflags()
will pass the right thing to getname_flags() and filename_lookup()
doesn't care about LOOKUP_EMPTY at all.

The things could be further simplified by use of cleanup.h stuff, but
let's not clutter the patch with that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro b756d8ba 2e2d892f

+7 -6
+7 -6
fs/utimes.c
··· 8 8 #include <linux/compat.h> 9 9 #include <asm/unistd.h> 10 10 #include <linux/filelock.h> 11 + #include "internal.h" 11 12 12 13 static bool nsec_valid(long nsec) 13 14 { ··· 84 83 { 85 84 struct path path; 86 85 int lookup_flags = 0, error; 86 + struct filename *name; 87 87 88 88 if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) 89 89 return -EINVAL; 90 90 91 91 if (!(flags & AT_SYMLINK_NOFOLLOW)) 92 92 lookup_flags |= LOOKUP_FOLLOW; 93 - if (flags & AT_EMPTY_PATH) 94 - lookup_flags |= LOOKUP_EMPTY; 93 + name = getname_uflags(filename, flags); 95 94 96 95 retry: 97 - error = user_path_at(dfd, filename, lookup_flags, &path); 96 + error = filename_lookup(dfd, name, lookup_flags, &path, NULL); 98 97 if (error) 99 - return error; 100 - 98 + goto out; 101 99 error = vfs_utimes(&path, times); 102 100 path_put(&path); 103 101 if (retry_estale(error, lookup_flags)) { 104 102 lookup_flags |= LOOKUP_REVAL; 105 103 goto retry; 106 104 } 107 - 105 + out: 106 + putname(name); 108 107 return error; 109 108 } 110 109