lkml.org 
[lkml]   [2012]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 12/12] vfs: fix renameat to retry on ESTALE errors
Date
...as always, rename is the messiest of the bunch...

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/namei.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0d54eb3..1db2814 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3274,12 +3274,15 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
char *from;
char *to;
int error;
+ unsigned int try = 0;
+ bool should_retry = false;

- error = user_path_parent(olddfd, oldname, &oldnd, &from, false);
+retry:
+ error = user_path_parent(olddfd, oldname, &oldnd, &from, try);
if (error)
goto exit;

- error = user_path_parent(newdfd, newname, &newnd, &to, false);
+ error = user_path_parent(newdfd, newname, &newnd, &to, try);
if (error)
goto exit1;

@@ -3348,12 +3351,18 @@ exit4:
dput(old_dentry);
exit3:
unlock_rename(new_dir, old_dir);
+ if (retry_estale(error, try++))
+ should_retry = true;
exit2:
path_put(&newnd.path);
putname(to);
exit1:
path_put(&oldnd.path);
putname(from);
+ if (should_retry) {
+ should_retry = false;
+ goto retry;
+ }
exit:
return error;
}
--
1.7.7.6


\
 
 \ /
  Last update: 2012-04-26 18:17    [W:0.072 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site