summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch')
-rw-r--r--meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch b/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch
new file mode 100644
index 0000000..37de8c3
--- /dev/null
+++ b/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch
@@ -0,0 +1,64 @@
+From: Jason Wessel <jason.wessel@windriver.com>
+Date: Sat, 23 Feb 2013 08:49:08 -0600
+Subject: [PATCH] fh_cache: fix statle nfs handle on rename problem
+
+The following test case fails with modern linunx kernels which cache
+the renamed inode.
+
+ % mkdir a;mkdir b;mv b a/;ls -l a
+ ls: a/b: Stale NFS file handle
+
+The issue is that nfserver was not updating the fh_cache with the new
+location of the inode, when it moves directories.
+
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+
+Upstream-Status: Pending
+
+---
+ fh_cache.c | 12 ++++++++++++
+ fh_cache.h | 1 +
+ nfs.c | 2 ++
+ 3 files changed, 15 insertions(+)
+
+--- a/fh_cache.c
++++ b/fh_cache.c
+@@ -199,6 +199,18 @@ static char *fh_cache_lookup(uint32 dev,
+ }
+
+ /*
++ * update a fh inode cache for an operation like rename
++ */
++void fh_cache_update(nfs_fh3 fh, char *path)
++{
++ unfs3_fh_t *obj = (void *) fh.data.data_val;
++ backend_statstruct buf;
++
++ if (backend_lstat(path, &buf) != -1) {
++ fh_cache_add(obj->dev, buf.st_ino, path);
++ }
++}
++/*
+ * resolve a filename into a path
+ * cache-using wrapper for fh_decomp_raw
+ */
+--- a/fh_cache.h
++++ b/fh_cache.h
+@@ -19,5 +19,6 @@ unfs3_fh_t fh_comp(const char *path, str
+ unfs3_fh_t *fh_comp_ptr(const char *path, struct svc_req *rqstp, int need_dir);
+
+ char *fh_cache_add(uint32 dev, uint64 ino, const char *path);
++void fh_cache_update(nfs_fh3 fh, char *path);
+
+ #endif
+--- a/nfs.c
++++ b/nfs.c
+@@ -876,6 +876,8 @@ RENAME3res *nfsproc3_rename_3_svc(RENAME
+ res = backend_rename(from_obj, to_obj);
+ if (res == -1)
+ result.status = rename_err();
++ /* Update the fh_cache with moved inode value */
++ fh_cache_update(argp->to.dir, to_obj);
+ }
+ }
+
OpenPOWER on IntegriCloud