Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/open.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/fs/open.c b/fs/open.c index 232cbfb..1bdfd9a 100644 --- a/fs/open.c +++ b/fs/open.c @@ -567,24 +567,29 @@ SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, struct path path; int error = -EINVAL; int lookup_flags; + unsigned int try = 0; if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0) - goto out; + return error; lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; if (flag & AT_EMPTY_PATH) lookup_flags |= LOOKUP_EMPTY; - error = user_path_at(dfd, filename, lookup_flags, &path); - if (error) - goto out; - error = mnt_want_write(path.mnt); - if (error) - goto out_release; - error = chown_common(&path, user, group); - mnt_drop_write(path.mnt); -out_release: - path_put(&path); -out: + + do { + error = user_path_at(dfd, filename, lookup_flags, &path); + if (error) + break; + + error = mnt_want_write(path.mnt); + if (!error) { + error = chown_common(&path, user, group); + mnt_drop_write(path.mnt); + } + + path_put(&path); + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); return error; } -- 1.7.11.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html