[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1352128933-28526-13-git-send-email-jlayton@redhat.com>
Date: Mon, 5 Nov 2012 10:21:51 -0500
From: Jeff Layton <jlayton@...hat.com>
To: viro@...iv.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, michael.brantley@...haw.com,
hch@...radead.org, miklos@...redi.hu, pstaubach@...grid.com
Subject: [PATCH v9 12/34] vfs: fix renameat to retry on ESTALE errors
...as always, rename is the messiest of the bunch. We have to track
whether to retry or not via a separate flag since the error handling
is already quite complex.
Signed-off-by: Jeff Layton <jlayton@...hat.com>
---
fs/namei.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index fb5a084..39adf1b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3856,15 +3856,18 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
struct nameidata oldnd, newnd;
struct filename *from;
struct filename *to;
+ unsigned int try = 0;
+ bool should_retry = false;
int error;
- from = user_path_parent(olddfd, oldname, &oldnd, 0);
+retry:
+ from = user_path_parent(olddfd, oldname, &oldnd, try);
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, try);
if (IS_ERR(to)) {
error = PTR_ERR(to);
goto exit1;
@@ -3936,11 +3939,17 @@ exit3:
unlock_rename(new_dir, old_dir);
mnt_drop_write(oldnd.path.mnt);
exit2:
+ if (retry_estale(error, try++))
+ should_retry = true;
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.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists