blob: d3194f080469cbb68a3ffdea2669463af7f033de [file] [log] [blame]
From 0c6b698a880f7b50f16af918228f4db7273cf814 Mon Sep 17 00:00:00 2001
From: David Howells <>
Date: Wed, 11 Dec 2019 08:56:04 +0000
Subject: [PATCH] afs: Fix creation calls in the dynamic root to fail with
commit 1da4bd9f9d187f53618890d7b66b9628bbec3c70 upstream.
Fix the lookup method on the dynamic root directory such that creation
calls, such as mkdir, open(O_CREAT), symlink, etc. fail with EOPNOTSUPP
rather than failing with some odd error (such as EEXIST).
lookup() itself tries to create automount directories when it is invoked.
These are cached locally in RAM and not committed to storage.
Signed-off-by: David Howells <>
Reviewed-by: Marc Dionne <>
Tested-by: Jonathan Billings <>
Signed-off-by: Paul Gortmaker <>
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 9b3b2f1f1fc0..13522d2b0ec9 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -141,6 +141,9 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr
ASSERTCMP(d_inode(dentry), ==, NULL);
+ if (flags & LOOKUP_CREATE)
if (dentry->d_name.len >= AFSNAMEMAX) {
_leave(" = -ENAMETOOLONG");