Skip to content

Commit 97ed55d

Browse files
author
Al Viro
committed
do_sys_truncate(): switch to CLASS(filename)
Note that failures from filename_lookup() are final - ESTALE returned by it means that retry had been done by filename_lookup() and it failed there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 7273ed4 commit 97ed55d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

fs/open.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,23 @@ EXPORT_SYMBOL_GPL(vfs_truncate);
129129
int do_sys_truncate(const char __user *pathname, loff_t length)
130130
{
131131
unsigned int lookup_flags = LOOKUP_FOLLOW;
132-
struct filename *name;
133132
struct path path;
134133
int error;
135134

136135
if (length < 0) /* sorry, but loff_t says... */
137136
return -EINVAL;
138137

139-
name = getname(pathname);
138+
CLASS(filename, name)(pathname);
140139
retry:
141140
error = filename_lookup(AT_FDCWD, name, lookup_flags, &path, NULL);
142141
if (!error) {
143142
error = vfs_truncate(&path, length);
144143
path_put(&path);
144+
if (retry_estale(error, lookup_flags)) {
145+
lookup_flags |= LOOKUP_REVAL;
146+
goto retry;
147+
}
145148
}
146-
if (retry_estale(error, lookup_flags)) {
147-
lookup_flags |= LOOKUP_REVAL;
148-
goto retry;
149-
}
150-
putname(name);
151149
return error;
152150
}
153151

0 commit comments

Comments
 (0)