aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs/configfs_internal.h
diff options
context:
space:
mode:
authorLouis Rilling <Louis.Rilling@kerlabs.com>2008-06-16 13:00:58 -0400
committerMark Fasheh <mfasheh@suse.com>2008-07-14 16:57:15 -0400
commit6f61076406251626be39651d114fac412b1e0c39 (patch)
treed7adb1de212cfb7ead490b448bf75ce3b3b91c9c /fs/configfs/configfs_internal.h
parentfe9f387740ac7cb3b7c2fffa76807e997e6c6292 (diff)
configfs: Introduce configfs_dirent_lock
This patch introduces configfs_dirent_lock spinlock to protect configfs_dirent traversals against linkage mutations (add/del/move). This will allow configfs_detach_prep() to avoid locking i_mutexes. Locking rules for configfs_dirent linkage mutations are the same plus the requirement of taking configfs_dirent_lock. For configfs_dirent walking, one can either take appropriate i_mutex as before, or take configfs_dirent_lock. The spinlock could actually be a mutex, but the critical sections are either O(1) or should not be too long (default groups walking in last patch). ChangeLog: - Clarify the comment on configfs_dirent_lock usage - Move sd->s_element init before linking the new dirent - In lseek(), do not release configfs_dirent_lock before the dirent is relinked. Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/configfs/configfs_internal.h')
-rw-r--r--fs/configfs/configfs_internal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index cca98609aa7f..5a33b58e66da 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/spinlock.h>
29 30
30struct configfs_dirent { 31struct configfs_dirent {
31 atomic_t s_count; 32 atomic_t s_count;
@@ -49,6 +50,8 @@ struct configfs_dirent {
49#define CONFIGFS_USET_DROPPING 0x0100 50#define CONFIGFS_USET_DROPPING 0x0100
50#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR) 51#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR)
51 52
53extern spinlock_t configfs_dirent_lock;
54
52extern struct vfsmount * configfs_mount; 55extern struct vfsmount * configfs_mount;
53extern struct kmem_cache *configfs_dir_cachep; 56extern struct kmem_cache *configfs_dir_cachep;
54 57