From e4708157ea55ef79d1c3a5387859618bdba90395 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 27 Dec 2009 11:28:43 +0000 Subject: [PATCH] Linux: Check for multiple silly renames We don't want to do multiple silly renames of the same dcache entry, so add a check for that occuring, and just return EBUSY if we're trying to do so. Change-Id: Ic1cb4061d89bf87926995162f1ac410375bddcb5 Reviewed-on: http://gerrit.openafs.org/1035 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/LINUX/osi_compat.h | 6 ++++++ src/afs/LINUX/osi_vnodeops.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index b97318645b..866d3fc57b 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -65,6 +65,12 @@ afs_linux_set_nfsfs_renamed(struct dentry *dp) { dp->d_flags |= DCACHE_NFSFS_RENAMED; spin_unlock(&dp->d_lock); } + +static inline int +afs_linux_nfsfs_renamed(struct dentry *dp) { + return dp->d_flags & DCACHE_NFSFS_RENAMED; +} + #else static inline void afs_linux_clear_nfsfs_renamed(void) { return; } static inline void afs_linux_set_nfsfs_renamed(void) { return; } diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 6543efde72..83a5ab0e66 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1130,6 +1130,9 @@ afs_linux_sillyrename(struct inode *dir, struct dentry *dentry, char *__name = NULL; int code; + if (afs_linux_nfsfs_renamed(dentry)) + return EBUSY; + do { dput(__dp);