public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RFC replace some locking of i_sem wiht atomic_t
@ 2006-04-01  0:08 Joshua Hudson
  2006-04-02 18:01 ` Joshua Hudson
  0 siblings, 1 reply; 4+ messages in thread
From: Joshua Hudson @ 2006-04-01  0:08 UTC (permalink / raw)
  To: linux-kernel

This might be a way to decrease complexity of locking in vfs.

Basic idea: for local filesystems, i_sem gets taken on several objects
only to protect i_nlink.
These can be removed if i_nlink is atomic.

For network filesystems, no amount of locking would ensure atomic
operations anyway, so
probably no loss there.

inode operations would then lock:
 lookup:   parent
 create:   parent
 link:       both parents
 mknod:   parent
 symlink:  parent
 mkdir:     parent
 unlink:    parent
 rmdir:     parent
 truncate: item
 rename:  both parents

A new per-superblock semaphore vfs_link_sem would be created, to be taken
first on both link and rename, dropped as soon as all other locks are taken.
This prevents deadlocks in pathelogical cases. vfs_rename_sem is still needed
(taken after vfs_link_sem) to prevent cycles from being created.

Grabbing the target on link doesn't do much for most filesystems
because the operation
is (or should be) syncronized by the page lock for each directory
pages. If this change
is made, it is possible to remove this locking from all the filesystems.

Note that locking of source or target is no longer necessary. Except
for i_nlink, nothing
can change the source or target anyway.

Comment as you will. I am competent to write this if it is wanted. I
expect however
that I will be flamed to ashes for this suggestion.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-02 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-01  0:08 RFC replace some locking of i_sem wiht atomic_t Joshua Hudson
2006-04-02 18:01 ` Joshua Hudson
2006-04-02 18:43   ` Al Viro
     [not found]     ` <bda6d13a0604021508g3cc03506yce0170166dc0eda2@mail.gmail.com>
2006-04-02 22:09       ` Joshua Hudson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox