summarylogtreecommitdiffstats
path: root/0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch
diff options
context:
space:
mode:
Diffstat (limited to '0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch')
-rw-r--r--0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch b/0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch
new file mode 100644
index 000000000000..52856dcbcc56
--- /dev/null
+++ b/0004-Linux-lock-the-parent-dentry-for-lookup_one_len.patch
@@ -0,0 +1,35 @@
+From a42d68d51dc8c864cf5fde02a8f0277e82ca8696 Mon Sep 17 00:00:00 2001
+From: Benjamin Kaduk <kaduk@mit.edu>
+Date: Sun, 1 May 2016 19:39:55 -0400
+Subject: [PATCH 4/5] Linux: lock the parent dentry for lookup_one_len()
+
+During review of the changes in Linux 4.5, it was noted that
+callers of lookup_one_len() are obligated to hold the i_mutex
+on the parent directory, though we do not currently do so.
+Take the lock around the call as needed.
+
+The only call to lookup_one_len() occurs in afs_linux_sillyrename(),
+so may workloads may not encounter this codepath.
+
+Change-Id: I4d566c9a704173973c062c3d38f1d481f76c42da
+---
+ src/afs/LINUX/osi_vnodeops.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index 00b41ef..532c9e9 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1654,7 +1654,9 @@ afs_linux_sillyrename(struct inode *dir, struct dentry *dentry,
+ __name = afs_newname();
+ AFS_GUNLOCK();
+
++ afs_linux_lock_inode(dentry->d_parent->d_inode);
+ __dp = lookup_one_len(__name, dentry->d_parent, strlen(__name));
++ afs_linux_unlock_inode(dentry->d_parent->d_inode);
+
+ if (IS_ERR(__dp)) {
+ osi_FreeSmallSpace(__name);
+--
+2.8.2
+