From ffe9315821a7deeab159562868538fbd13c91a5f Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 11 Dec 2012 12:10:10 -0500 Subject: [PATCH] --- yaml --- r: 347850 b: refs/heads/master c: c6a9428401c00a27d3c17264934d14e284570c97 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index fb25df28c817..7b4aafec641c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5d18f8133cad85ccbb7fa6fd351d75025da32504 +refs/heads/master: c6a9428401c00a27d3c17264934d14e284570c97 diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 8a262c2efff8..43a97ee1d4c8 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -3840,15 +3840,17 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, struct nameidata oldnd, newnd; struct filename *from; struct filename *to; + unsigned int lookup_flags = 0; + bool should_retry = false; int error; - - from = user_path_parent(olddfd, oldname, &oldnd, 0); +retry: + from = user_path_parent(olddfd, oldname, &oldnd, lookup_flags); if (IS_ERR(from)) { error = PTR_ERR(from); goto exit; } - to = user_path_parent(newdfd, newname, &newnd, 0); + to = user_path_parent(newdfd, newname, &newnd, lookup_flags); if (IS_ERR(to)) { error = PTR_ERR(to); goto exit1; @@ -3920,11 +3922,18 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, unlock_rename(new_dir, old_dir); mnt_drop_write(oldnd.path.mnt); exit2: + if (retry_estale(error, lookup_flags)) + should_retry = true; path_put(&newnd.path); putname(to); exit1: path_put(&oldnd.path); putname(from); + if (should_retry) { + should_retry = false; + lookup_flags |= LOOKUP_REVAL; + goto retry; + } exit: return error; }