Commit f46d3567b223e41e1f2faeb82d3b74a6d84fc508
Committed by
Al Viro
1 parent
b76d8b8226
Exists in
master
and in
20 other branches
vfs: fix symlinkat to retry on ESTALE errors
Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -3521,12 +3521,13 @@ |
3521 | 3521 | struct filename *from; |
3522 | 3522 | struct dentry *dentry; |
3523 | 3523 | struct path path; |
3524 | + unsigned int lookup_flags = 0; | |
3524 | 3525 | |
3525 | 3526 | from = getname(oldname); |
3526 | 3527 | if (IS_ERR(from)) |
3527 | 3528 | return PTR_ERR(from); |
3528 | - | |
3529 | - dentry = user_path_create(newdfd, newname, &path, 0); | |
3529 | +retry: | |
3530 | + dentry = user_path_create(newdfd, newname, &path, lookup_flags); | |
3530 | 3531 | error = PTR_ERR(dentry); |
3531 | 3532 | if (IS_ERR(dentry)) |
3532 | 3533 | goto out_putname; |
... | ... | @@ -3535,6 +3536,10 @@ |
3535 | 3536 | if (!error) |
3536 | 3537 | error = vfs_symlink(path.dentry->d_inode, dentry, from->name); |
3537 | 3538 | done_path_create(&path, dentry); |
3539 | + if (retry_estale(error, lookup_flags)) { | |
3540 | + lookup_flags |= LOOKUP_REVAL; | |
3541 | + goto retry; | |
3542 | + } | |
3538 | 3543 | out_putname: |
3539 | 3544 | putname(from); |
3540 | 3545 | return error; |