vfs: fix mknodat to retry on ESTALE errors

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Jeff Layton 2012-12-20 16:00:10 -05:00 committed by Al Viro
parent 1ac12b4b6d
commit 972567f14c
1 changed files with 7 additions and 2 deletions

View File

@ -3172,12 +3172,13 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
struct dentry *dentry; struct dentry *dentry;
struct path path; struct path path;
int error; int error;
unsigned int lookup_flags = 0;
error = may_mknod(mode); error = may_mknod(mode);
if (error) if (error)
return error; return error;
retry:
dentry = user_path_create(dfd, filename, &path, 0); dentry = user_path_create(dfd, filename, &path, lookup_flags);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return PTR_ERR(dentry); return PTR_ERR(dentry);
@ -3200,6 +3201,10 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
} }
out: out:
done_path_create(&path, dentry); done_path_create(&path, dentry);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
return error; return error;
} }