configfs: Introduce configfs_dirent_lock
authorLouis Rilling <Louis.Rilling@kerlabs.com>
Mon, 16 Jun 2008 17:00:58 +0000 (19:00 +0200)
committerMark Fasheh <mfasheh@suse.com>
Mon, 14 Jul 2008 20:57:15 +0000 (13:57 -0700)
commit6f61076406251626be39651d114fac412b1e0c39
treed7adb1de212cfb7ead490b448bf75ce3b3b91c9c
parentfe9f387740ac7cb3b7c2fffa76807e997e6c6292
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>
fs/configfs/configfs_internal.h
fs/configfs/dir.c
fs/configfs/inode.c
fs/configfs/symlink.c