LKML Archive on
help / color / mirror / Atom feed
* [git patches] ocfs2 and configfs updates
@ 2007-02-08 18:30 Mark Fasheh
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2007-02-08 18:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, linux-kernel, ocfs2-devel, joel.becker

Hi Linus,

Included in this patchset is:

* A rather involved series of ocfs2 dlm fixes - these were too large (and
  tested too late) to really go into 2.6.20. Mostly this revolves around
  lock migration race fixes. Most forms of migration had been temporarily
  disabled in the ocfs2 dlm due to those problems, but with these patches it
  works great again.

* Some cleanups in heartbeat code, and our section of fs/Kconfig.

* A small configfs fix from Joel.

So nothing major in the feature area for now, just some more bugfixes and

Please pull from 'upstream-linus' branch of
git:// upstream-linus

to receive the following updates:

 fs/Kconfig                      |    1 
 fs/configfs/file.c              |    9 
 fs/ocfs2/cluster/heartbeat.c    |  158 ++--------
 fs/ocfs2/cluster/tcp.c          |   35 +-
 fs/ocfs2/cluster/tcp.h          |    6 
 fs/ocfs2/cluster/tcp_internal.h |   12 
 fs/ocfs2/dlm/dlmast.c           |   14 
 fs/ocfs2/dlm/dlmcommon.h        |  130 +++++++-
 fs/ocfs2/dlm/dlmconvert.c       |   40 --
 fs/ocfs2/dlm/dlmdebug.c         |   30 +-
 fs/ocfs2/dlm/dlmdomain.c        |  253 +++++++++++++----
 fs/ocfs2/dlm/dlmlock.c          |    7 
 fs/ocfs2/dlm/dlmmaster.c        |  579 +++++++++++++++++++++++++++++++++++-----
 fs/ocfs2/dlm/dlmrecovery.c      |  182 ++++++++++--
 fs/ocfs2/dlm/dlmthread.c        |  200 ++++++-------
 fs/ocfs2/dlm/dlmunlock.c        |   15 -
 fs/ocfs2/vote.c                 |    8 
 17 files changed, 1211 insertions(+), 468 deletions(-)

Adrian Bunk:
      fs/ocfs2/dlm/: make functions static

Joel Becker:
      configfs: Zero terminate data in configfs attribute writes.

Kurt Hackel:
      ocfs2_dlm: fix cluster-wide refcounting of lock resources
      ocfs2_dlm: Fixes race between migrate and dirty
      ocfs2_dlm: Make dlmunlock() wait for migration to complete
      ocfs2_dlm: Fix migrate lockres handler queue scanning
      ocfs2_dlm: Flush dlm workqueue before starting to migrate
      ocfs2_dlm: Drop inflight refmap even if no locks found on the lockres
      ocfs2_dlm: Dlm dispatch was stopping too early
      ocfs2_dlm: wake up sleepers on the lockres waitqueue
      ocfs2_dlm: Silence a failed convert
      ocfs2_dlm: Cookies in locks not being printed correctly in error messages
      ocfs2: Added post handler callable function in o2net message handler
      ocfs2_dlm: Calling post handler function in assert master handler

Philipp Reisner:
      ocfs2 heartbeat: clean up bio submission code

Randy Dunlap:
      ocfs2: drop INET from Kconfig, not needed

Srinivas Eeda:
      ocfs2_dlm: disallow a domain join if node maps mismatch

Sunil Mushran:
      ocfs2: Binds listener to the configured ip address
      ocfs2_dlm: Ensure correct ordering of set/clear refmap bit on lockres
      ocfs2_dlm: Silence some messages during join domain
      ocfs2_dlm: Add timeout to dlm join domain

Zhen Wei:
      ocfs2: introduce sc->sc_send_lock to protect outbound outbound messages


Mark Fasheh
Senior Software Developer, Oracle

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

* [git patches] ocfs2 and configfs updates
@ 2008-01-25 23:16 Mark Fasheh
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2008-01-25 23:16 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, linux-kernel, ocfs2-devel, Joel Becker, David Teigland

These patches comprise the bulk of our outstanding changes for Ocfs2 and

Configfs gets some lockdep updates, and we remove it's EXPERIMENTAL tag as
things have been quite stable for some time now.

Ocfs2 gets fixes that made it in too late for 2.6.24, and several new
features. The most interesting are listed below:

We've been on the path to removing the "vote" cluster messaging in Ocfs2 for
some time now. I'm happy to announce that this series gets rid of the last
set of messages, which were used for "mount" and "unmount". Though not
really a performance problem, the messages required that Ocfs2 track node
information such as IP address, port, etc. By removing those votes, we no
longer need that information in the file system (the dlm still uses it, but
that's ok). As such, total kernel code complexity goes down and we get Ocfs2
in shape for a future where the cluster stack can be kept in userspace and
Ocfs2 can then easily plug into something like fs/dlm.

Initially, Ocfs2 was designed with two locks per inode - a "meta lock"
covering inode meta data, and a "data lock" covering inode data. Recently,
that decision has been revisited in light of some facts: The majority of
users mount the file system in data=ordered mode, which means that
transferring a meta data lock also syncs inode data. Having a 2nd, mostly
unused lock in place only meant extra messaging for lock mastery. Merging
the functionality into one inode lock improves that situation by
streamlining the most common cases of cluster locking.

Ocfs2 now supports online resize. Userspace does most of the setup and then
initiates the operation via a set of Ocfs2 specific ioctls(). This is
similar to how ext3 handles things, though we don't use the same exact
ioctls because Ocfs2 has a different disk structure.

Finally, Ocfs2 now supports cluster aware flock(). This is pretty straight
forward in that we map flock() requests directly to dlm locks. Mandatory
locks aren't supported, as they would require some expensive cluster
messaging. Posix file locks (lockf()) support is a very early work in
progress, so it'll have to wait until at least 2.6.26, quite possibly later.
In the meantime, flock() support is ready and works well.

Also included in this series is a trivial patch to split out some of
include/linux/dlm.h into an include/linux/dlmconstants.h. It's actually part
of a series of patches targetting 2.6.26 which teach Ocfs2 how to optionally
plug into fs/dlm. The patch stands on it's own as a nice cleanup though, so
I'm sending it out for 2.6.25.

And of course, all changes made as a result of comments on the patches (I
sent them out last week) are included.

Please pull from 'upstream-linus' branch of
git:// upstream-linus

to receive the following updates:

 Documentation/filesystems/ocfs2.txt |   16 +-
 Documentation/ioctl-number.txt      |    1 +
 fs/Kconfig                          |   14 +-
 fs/configfs/dir.c                   |    5 +-
 fs/configfs/file.c                  |    2 +-
 fs/ocfs2/Makefile                   |    5 +-
 fs/ocfs2/alloc.c                    |    8 +-
 fs/ocfs2/aops.c                     |  137 ++++---
 fs/ocfs2/buffer_head_io.c           |   65 +++-
 fs/ocfs2/buffer_head_io.h           |    2 +
 fs/ocfs2/cluster/heartbeat.h        |    2 +-
 fs/ocfs2/cluster/tcp.h              |    4 +-
 fs/ocfs2/cluster/tcp_internal.h     |    8 +-
 fs/ocfs2/cluster/ver.c              |    2 +-
 fs/ocfs2/dcache.c                   |    8 +-
 fs/ocfs2/dir.c                      |    8 +-
 fs/ocfs2/dlm/dlmfsver.c             |    2 +-
 fs/ocfs2/dlm/dlmrecovery.c          |   19 +-
 fs/ocfs2/dlm/dlmver.c               |    2 +-
 fs/ocfs2/dlmglue.c                  |  546 +++++++++++++++++++-------
 fs/ocfs2/dlmglue.h                  |   31 +-
 fs/ocfs2/endian.h                   |    5 -
 fs/ocfs2/export.c                   |    8 +-
 fs/ocfs2/file.c                     |  163 +++++---
 fs/ocfs2/file.h                     |    6 +
 fs/ocfs2/heartbeat.c                |   80 ----
 fs/ocfs2/heartbeat.h                |    2 -
 fs/ocfs2/inode.c                    |   84 ++--
 fs/ocfs2/inode.h                    |   10 +-
 fs/ocfs2/ioctl.c                    |   31 ++-
 fs/ocfs2/journal.c                  |   51 ++--
 fs/ocfs2/journal.h                  |    6 +
 fs/ocfs2/localalloc.c               |   50 ++-
 fs/ocfs2/locks.c                    |  125 ++++++
 fs/ocfs2/{vote.h => locks.h}        |   29 +-
 fs/ocfs2/mmap.c                     |   17 +-
 fs/ocfs2/namei.c                    |   66 ++--
 fs/ocfs2/ocfs2.h                    |   35 +-
 fs/ocfs2/ocfs2_fs.h                 |   22 +
 fs/ocfs2/ocfs2_lockid.h             |    5 +
 fs/ocfs2/resize.c                   |  634 +++++++++++++++++++++++++++++
 fs/ocfs2/{vote.h => resize.h}       |   32 +--
 fs/ocfs2/slot_map.c                 |   19 -
 fs/ocfs2/slot_map.h                 |    2 -
 fs/ocfs2/suballoc.c                 |   20 +-
 fs/ocfs2/suballoc.h                 |    8 +
 fs/ocfs2/super.c                    |  140 ++++----
 fs/ocfs2/sysfile.c                  |    2 +-
 fs/ocfs2/ver.c                      |    2 +-
 fs/ocfs2/vote.c                     |  756 -----------------------------------
 include/linux/Kbuild                |    1 +
 include/linux/dlm.h                 |  140 +-------
 include/linux/dlmconstants.h        |  159 ++++++++
 53 files changed, 1981 insertions(+), 1616 deletions(-)
 create mode 100644 fs/ocfs2/locks.c
 copy fs/ocfs2/{vote.h => locks.h} (54%)
 create mode 100644 fs/ocfs2/resize.c
 rename fs/ocfs2/{vote.h => resize.h} (50%)
 delete mode 100644 fs/ocfs2/vote.c
 create mode 100644 include/linux/dlmconstants.h

Jan Kara (4):
      ocfs2: Silence false lockdep warnings
      ocfs2: Safer read_inline_data()
      ocfs2: Use generic_file_llseek
      ocfs2: printf fixes

Joel Becker (2):
      dlm: Split lock mode and flag constants into a sharable header.
      configfs: Remove EXPERIMENTAL

Joonwoo Park (2):
      configfs: dir.c fix possible recursive locking
      configfs: file.c fix possible recursive locking

Marcin Slusarz (1):
      ocfs2: convert byte order of constant instead of variable

Mark Fasheh (15):
      ocfs2_dlm: Call node eviction callbacks from heartbeat handler
      ocfs2: Remove fs dependency on ocfs2_heartbeat module
      ocfs2: Remove mount/unmount votes
      ocfs2: Add data downconvert worker to inode lock
      ocfs2: Remove data locks
      ocfs2: Rename ocfs2_meta_[un]lock
      ocfs2: Readpages support
      ocfs2: Documentation update
      ocfs2: Add missing permission checks
      ocfs2: Support commit= mount option
      ocfs2: add flock lock type
      ocfs2: cluster aware flock()
      ocfs2: bump version number
      ocfs2: document access rules for blocked_lock_list
      ocfs2: clean up bh null checks

Sunil Mushran (2):
      ocfs2: Local alloc window size changeable via mount option
      ocfs2: Update default cluster timeouts

Tao Ma (5):
      ocfs2: Initalize bitmap_cpg of ocfs2_super to be the maximum.
      ocfs2: Reserve ioctl range
      ocfs2: Add group extend for online resize
      ocfs2: Implement group add for online resize
      ocfs2/dlm: Clear joining_node on hearbeat node down

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

* [git patches] ocfs2 and configfs updates
@ 2007-07-11 16:22 Mark Fasheh
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2007-07-11 16:22 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, linux-kernel, ocfs2-devel, David Teigland, Joel Becker

This represents the majority of our 2.6.23-rc1 patches.

I'll start with ocfs2, which gets the following new features:

* Full support for shared writeable mmap. This was implemented using the
  ->page_mkwrite callback to allow ocfs2 a chance to take cluster locks on
  the inode data and allocate file space for writes. This also has the
  effect that ocfs2 should never run out of space during ->writepage.

* Some internal improvements to how deallocation of meta-data is handled. 
  This simplified deallocation locking so that we could turn on allocation
  of meta data from per-node pools.

* Unwritten extents support. ocfs2 can now pre-allocate inode space without
  zeroing data by leaving a special "unwritten" flag in the extent record. 
  Reads from regions marked as unwritten return zeros and writes to the
  regions are guaranteed to never require data allocation. The sparse file
  support in Ocfs2 (from 2.6.22) included read support for unwritten
  extents, so the file system option is an RO compat bit. It won't ever be
  turned on by ocfs2-tools without first having the sparse files incompat
  bit set.

* Support for removing arbitrary file regions. Conceptually this is the
  opposite of unwritten extents support. The ocfs2 btree code is now smart
  enough to remove any extent or partial extent, regardless of where it is
  in the tree. Previously it was only possible to remove extents from the
  rightmost edge during a truncate.

The reservation and extent truncate support is exposed to user space via a
set of ioctls compatible with those currently used by XFS. This allows us to
take advantage of the existing install base of software which uses that
feature. Some weeks ago, I also posted an -mm patch to get ocfs2 under the
->fallocate() callback. Once the sys_fallocate() patches are merged, I
intend to send a version of the ocfs2 patch upstream.

On the Configfs side, these patches include a series of cleanups and some
API adjustments.

* Drivers now have the ability to specify a dependancy on config items. This
  allows clients to pin certain objects when removal would have bad
  consequences. ocfs2 uses this functionality to codify a mountpoints
  dependancy on a live heartbeat.

* A new notification callback, ops->disconnect_notify() is added which is
  called just before item linkage is broken during removal. This allows
  configfs users to do work on the item while it is still in the hierarchy.

Three of the configfs patches which modify the api touch code in fs/dlm (in
fairly trivial ways) so David has been CC'd. Those patches are also attached
to the end of this mail. I had to fix some conflicts with an fs/dlm/config.c
change when getting two of those ready for merge so the commit messages have
been marked as such.

Please pull from 'upstream-linus' branch of
git:// upstream-linus

to receive the following updates:

 Documentation/filesystems/configfs/configfs.txt       |   57 
 Documentation/filesystems/configfs/configfs_example.c |    2 
 fs/configfs/configfs_internal.h                       |    7 
 fs/configfs/dir.c                                     |  289 +
 fs/configfs/file.c                                    |   28 
 fs/configfs/item.c                                    |   29 
 fs/dlm/config.c                                       |   20 
 fs/ocfs2/alloc.c                                      | 2676 ++++++++++++++++--
 fs/ocfs2/alloc.h                                      |   43 
 fs/ocfs2/aops.c                                       | 1015 ++++--
 fs/ocfs2/aops.h                                       |   61 
 fs/ocfs2/cluster/heartbeat.c                          |   96 
 fs/ocfs2/cluster/heartbeat.h                          |    6 
 fs/ocfs2/cluster/nodemanager.c                        |   42 
 fs/ocfs2/cluster/nodemanager.h                        |    5 
 fs/ocfs2/cluster/tcp.c                                |   21 
 fs/ocfs2/dir.c                                        |    2 
 fs/ocfs2/dlm/dlmdomain.c                              |    8 
 fs/ocfs2/dlm/dlmmaster.c                              |   40 
 fs/ocfs2/dlm/dlmrecovery.c                            |   79 
 fs/ocfs2/dlmglue.c                                    |    6 
 fs/ocfs2/endian.h                                     |    5 
 fs/ocfs2/extent_map.c                                 |   41 
 fs/ocfs2/file.c                                       |  702 ++++
 fs/ocfs2/file.h                                       |   10 
 fs/ocfs2/heartbeat.c                                  |   10 
 fs/ocfs2/ioctl.c                                      |   15 
 fs/ocfs2/journal.c                                    |    6 
 fs/ocfs2/journal.h                                    |    2 
 fs/ocfs2/mmap.c                                       |  167 -
 fs/ocfs2/namei.c                                      |    2 
 fs/ocfs2/ocfs2.h                                      |   14 
 fs/ocfs2/ocfs2_fs.h                                   |   33 
 fs/ocfs2/slot_map.c                                   |   12 
 fs/ocfs2/suballoc.c                                   |   46 
 fs/ocfs2/suballoc.h                                   |   17 
 fs/ocfs2/super.c                                      |   27 
 fs/ocfs2/super.h                                      |    2 
 include/linux/configfs.h                              |   34 
 39 files changed, 4623 insertions(+), 1054 deletions(-)

Christoph Hellwig:
      ocfs2: use list_for_each_entry where benefical

Eric Sandeen:
      ocfs2: zero_user_page conversion

Joel Becker:
      configfs: consistent attribute size
      configfs: Convert subsystem semaphore to mutex
      configfs: accessing item hierarchy during rmdir(2)
      configfs: config item dependancies.
      ocfs2: Depend on configfs heartbeat items.
      ocfs2: live heartbeat depends on the local node configuration
      ocfs2: Wake up a starting region if it gets killed in the background.

Johannes Berg:
      configsfs buffer: use mutex

Mark Fasheh:
      ocfs2: take ip_alloc_sem during entire truncate
      ocfs2: rework ocfs2_buffered_write_cluster()
      ocfs2: factor out write aops into nolock variants
      ocfs2: shared writeable mmap
      ocfs2: harden buffer check during mapping of page blocks
      ocfs2: simplify deallocation locking
      ocfs2: plug truncate into cached dealloc routines
      ocfs2: use all extent block suballocators
      ocfs2: abstract btree growing calls
      ocfs2: btree changes for unwritten extents
      ocfs2: small cleanup of ocfs2_write_begin_nolock()
      ocfs2: support writing of unwritten extents
      ocfs2: Support creation of unwritten extents
      ocfs2: btree support for removal of arbirtrary extents
      ocfs2: update truncate handling of partial clusters
      ocfs2: support for removing file regions
      ocfs2: Support xfs style space reservation ioctls

Satyam Sharma:
      configfs: misc cleanups
      configfs+dlm: Separate out __CONFIGFS_ATTR into configfs.h
      configfs+dlm: Rename config_group_find_obj and state semantics clearly

Shani Moideen:
      [KJ PATCH] Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in fs/ocfs2/dlm/dlmrecovery.c

Sunil Mushran:
      ocfs2: Add "preferred slot" mount option

Mark Fasheh
Senior Software Developer, Oracle

From: Satyam Sharma <>

[PATCH] configfs+dlm: Separate out __CONFIGFS_ATTR into configfs.h

fs/dlm/config.c contains a useful generic macro called __CONFIGFS_ATTR
that is similar to sysfs' __ATTR macro that makes defining attributes
easy for any user of configfs. Separate it out into configfs.h so that
other users (forthcoming in dynamic netconsole patchset) can use it too.

Signed-off-by: Satyam Sharma <>
Cc: David Teigland <>
Signed-off-by: Joel Becker <>
Signed-off-by: Mark Fasheh <>
 fs/dlm/config.c          |    8 --------
 include/linux/configfs.h |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 5069b2c..e47eb42 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -133,14 +133,6 @@ static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field,
 	return len;
-#define __CONFIGFS_ATTR(_name,_mode,_read,_write) {                           \
-	.attr   = { .ca_name = __stringify(_name),                            \
-		    .ca_mode = _mode,                                         \
-		    .ca_owner = THIS_MODULE },                                \
-	.show   = _read,                                                      \
-	.store  = _write,                                                     \
 #define CLUSTER_ATTR(name, check_zero)                                        \
 static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len)  \
 {                                                                             \
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3d4a96e..def7c83 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -130,6 +130,22 @@ struct configfs_attribute {
 	mode_t			ca_mode;
+ * Users often need to create attribute structures for their configurable
+ * attributes, containing a configfs_attribute member and function pointers
+ * for the show() and store() operations on that attribute. They can use
+ * this macro (similar to sysfs' __ATTR) to make defining attributes easier.
+ */
+#define __CONFIGFS_ATTR(_name, _mode, _show, _store)			\
+{									\
+	.attr	= {							\
+			.ca_name = __stringify(_name),			\
+			.ca_mode = _mode,				\
+			.ca_owner = THIS_MODULE,			\
+	},								\
+	.show	= _show,						\
+	.store	= _store,						\
  * If allow_link() exists, the item can symlink(2) out to other

From: Satyam Sharma <>

[PATCH] configfs+dlm: Rename config_group_find_obj and state semantics clearly

Configfs being based upon sysfs code, config_group_find_obj() is probably
so named because of the similar kset_find_obj() in sysfs. However,
"kobject"s in sysfs become "config_item"s in configfs, so let's call it
config_group_find_item() instead, for sake of uniformity, and make
corresponding change in the users of this function.

BTW a crucial difference between kset_find_obj and config_group_find_item
is in locking expectations. kset_find_obj does its locking by itself, but
config_group_find_item expects the *caller* to do the locking. The reason
for this: kset's have their own locks, config_group's don't but instead
rely on the subsystem mutex. And, subsystem needn't necessarily be around
when config_group_find_item() is called.

So let's state these locking semantics explicitly, and rectify the comment,
otherwise bugs could continue to occur in future, as they did in the past
(refer commit d82b8191e238 in gfs2-2.6-fixes.git).

[ I also took the opportunity to fix some bad whitespace and
double-empty lines. --Joel ]

[ Conflict in fs/dlm/config.c with commit
  3168b0780d06ace875696f8a648d04d6089654e5 manually resolved. --Mark ]

Signed-off-by: Satyam Sharma <>
Cc: David Teigland <>
Signed-off-by: Joel Becker <>
Signed-off-by: Mark Fasheh <>
 fs/configfs/item.c       |   18 ++++++++----------
 fs/dlm/config.c          |    2 +-
 include/linux/configfs.h |    7 ++-----
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index b762bbe..76dc4c3 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -183,27 +183,25 @@ void config_group_init(struct config_group *group)
- *	config_group_find_obj - search for item in group.
+ *	config_group_find_item - search for item in group.
  *	@group:	group we're looking in.
  *	@name:	item's name.
- *	Lock group via @group->cg_subsys, and iterate over @group->cg_list,
- *	looking for a matching config_item. If matching item is found
- *	take a reference and return the item.
+ *	Iterate over @group->cg_list, looking for a matching config_item.
+ *	If matching item is found take a reference and return the item.
+ *	Caller must have locked group via @group->cg_subsys->su_mtx.
-struct config_item *config_group_find_obj(struct config_group *group,
-					  const char * name)
+struct config_item *config_group_find_item(struct config_group *group,
+					   const char *name)
 	struct list_head * entry;
 	struct config_item * ret = NULL;
-        /* XXX LOCKING! */
 	list_for_each(entry,&group->cg_children) {
 		struct config_item * item = to_item(entry);
 		if (config_item_name(item) &&
-                    !strcmp(config_item_name(item), name)) {
+		    !strcmp(config_item_name(item), name)) {
 			ret = config_item_get(item);
@@ -215,4 +213,4 @@ EXPORT_SYMBOL(config_item_init);
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index e47eb42..4348cb4 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -752,7 +752,7 @@ static struct space *get_space(char *name)
 		return NULL;
-	i = config_group_find_obj(space_list, name);
+	i = config_group_find_item(space_list, name);
 	return to_space(i);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index def7c83..bbb1b6c 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -86,12 +86,10 @@ struct config_item_type {
 	struct configfs_attribute		**ct_attrs;
  *	group - a group of config_items of a specific type, belonging
  *	to a specific subsystem.
 struct config_group {
 	struct config_item		cg_item;
 	struct list_head		cg_children;
@@ -99,13 +97,11 @@ struct config_group {
 	struct config_group		**default_groups;
 extern void config_group_init(struct config_group *group);
 extern void config_group_init_type_name(struct config_group *group,
 					const char *name,
 					struct config_item_type *type);
 static inline struct config_group *to_config_group(struct config_item *item)
 	return item ? container_of(item,struct config_group,cg_item) : NULL;
@@ -121,7 +117,8 @@ static inline void config_group_put(struct config_group *group)
-extern struct config_item *config_group_find_obj(struct config_group *, const char *);
+extern struct config_item *config_group_find_item(struct config_group *,
+						  const char *);
 struct configfs_attribute {

>From e6bd07aee739566803425acdbf5cdb29919164e1 Mon Sep 17 00:00:00 2001
From: Joel Becker <>
Date: Fri, 6 Jul 2007 23:33:17 -0700
Subject: configfs: Convert subsystem semaphore to mutex

Convert the su_sem member of struct configfs_subsystem to a struct
mutex, as that's what it is. Also convert all the users and update
Documentation/configfs.txt and Documentation/configfs_example.c

[ Conflict in fs/dlm/config.c with commit
  3168b0780d06ace875696f8a648d04d6089654e5 manually resolved. --Mark ]

Inspired-by: Satyam Sharma <>
Signed-off-by: Joel Becker <>
Signed-off-by: Mark Fasheh <>
 Documentation/filesystems/configfs/configfs.txt    |   18 +++++++++---------
 .../filesystems/configfs/configfs_example.c        |    2 +-
 fs/configfs/dir.c                                  |   16 ++++++++--------
 fs/dlm/config.c                                    |   10 +++++-----
 fs/ocfs2/cluster/nodemanager.c                     |    2 +-
 include/linux/configfs.h                           |    4 ++--
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index b34cdb5..21f038e 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -280,18 +280,18 @@ tells configfs to make the subsystem appear in the file tree.
 	struct configfs_subsystem {
 		struct config_group	su_group;
-		struct semaphore	su_sem;
+		struct mutex		su_mutex;
 	int configfs_register_subsystem(struct configfs_subsystem *subsys);
 	void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
-	A subsystem consists of a toplevel config_group and a semaphore.
+	A subsystem consists of a toplevel config_group and a mutex.
 The group is where child config_items are created.  For a subsystem,
 this group is usually defined statically.  Before calling
 configfs_register_subsystem(), the subsystem must have initialized the
 group via the usual group _init() functions, and it must also have
-initialized the semaphore.
+initialized the mutex.
 	When the register call returns, the subsystem is live, and it
 will be visible via configfs.  At that point, mkdir(2) can be called and
 the subsystem must be ready for it.
@@ -303,7 +303,7 @@ subsystem/group and the simple_child item in configfs_example.c  It
 shows a trivial object displaying and storing an attribute, and a simple
 group creating and destroying these children.
-[Hierarchy Navigation and the Subsystem Semaphore]
+[Hierarchy Navigation and the Subsystem Mutex]
 There is an extra bonus that configfs provides.  The config_groups and
 config_items are arranged in a hierarchy due to the fact that they
@@ -314,19 +314,19 @@ and config_item->ci_parent structure members.
 A subsystem can navigate the cg_children list and the ci_parent pointer
 to see the tree created by the subsystem.  This can race with configfs'
-management of the hierarchy, so configfs uses the subsystem semaphore to
+management of the hierarchy, so configfs uses the subsystem mutex to
 protect modifications.  Whenever a subsystem wants to navigate the
 hierarchy, it must do so under the protection of the subsystem
-A subsystem will be prevented from acquiring the semaphore while a newly
+A subsystem will be prevented from acquiring the mutex while a newly
 allocated item has not been linked into this hierarchy.   Similarly, it
-will not be able to acquire the semaphore while a dropping item has not
+will not be able to acquire the mutex while a dropping item has not
 yet been unlinked.  This means that an item's ci_parent pointer will
 never be NULL while the item is in configfs, and that an item will only
 be in its parent's cg_children list for the same duration.  This allows
 a subsystem to trust ci_parent and cg_children while they hold the
 [Item Aggregation Via symlink(2)]
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c
index 2d6a14a..e56d492 100644
--- a/Documentation/filesystems/configfs/configfs_example.c
+++ b/Documentation/filesystems/configfs/configfs_example.c
@@ -453,7 +453,7 @@ static int __init configfs_example_init(void)
 		subsys = example_subsys[i];
-		init_MUTEX(&subsys->su_sem);
+		mutex_init(&subsys->su_mutex);
 		ret = configfs_register_subsystem(subsys);
 		if (ret) {
 			printk(KERN_ERR "Error %d while registering subsystem %s\n",
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 5e6e37e..d3b1dbb 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -562,7 +562,7 @@ static int populate_groups(struct config_group *group)
  * All of link_obj/unlink_obj/link_group/unlink_group require that
- * subsys->su_sem is held.
+ * subsys->su_mutex is held.
 static void unlink_obj(struct config_item *item)
@@ -783,7 +783,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	snprintf(name, dentry->d_name.len + 1, "%s", dentry->;
-	down(&subsys->su_sem);
+	mutex_lock(&subsys->su_mutex);
 	group = NULL;
 	item = NULL;
 	if (type->ct_group_ops->make_group) {
@@ -797,7 +797,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 		if (item)
 			link_obj(parent_item, item);
-	up(&subsys->su_sem);
+	mutex_unlock(&subsys->su_mutex);
 	if (!item) {
@@ -841,13 +841,13 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	if (ret) {
 		/* Tear down everything we built up */
-		down(&subsys->su_sem);
+		mutex_lock(&subsys->su_mutex);
 		if (group)
 		client_drop_item(parent_item, item);
-		up(&subsys->su_sem);
+		mutex_unlock(&subsys->su_mutex);
 		if (module_got)
@@ -910,17 +910,17 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
 	if (sd->s_type & CONFIGFS_USET_DIR) {
-		down(&subsys->su_sem);
+		mutex_lock(&subsys->su_mutex);
 	} else {
-		down(&subsys->su_sem);
+		mutex_lock(&subsys->su_mutex);
 	client_drop_item(parent_item, item);
-	up(&subsys->su_sem);
+	mutex_unlock(&subsys->su_mutex);
 	/* Drop our reference from above */
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 4348cb4..2f8e3c8 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -607,7 +607,7 @@ static struct clusters clusters_root = {
 int dlm_config_init(void)
-	init_MUTEX(&clusters_root.subsys.su_sem);
+	mutex_init(&clusters_root.subsys.su_mutex);
 	return configfs_register_subsystem(&clusters_root.subsys);
@@ -751,9 +751,9 @@ static struct space *get_space(char *name)
 	if (!space_list)
 		return NULL;
-	down(&space_list->cg_subsys->su_sem);
+	mutex_lock(&space_list->cg_subsys->su_mutex);
 	i = config_group_find_item(space_list, name);
-	up(&space_list->cg_subsys->su_sem);
+	mutex_unlock(&space_list->cg_subsys->su_mutex);
 	return to_space(i);
@@ -772,7 +772,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
 	if (!comm_list)
 		return NULL;
-	down(&clusters_root.subsys.su_sem);
+	mutex_lock(&clusters_root.subsys.su_mutex);
 	list_for_each_entry(i, &comm_list->cg_children, ci_entry) {
 		cm = to_comm(i);
@@ -792,7 +792,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
-	up(&clusters_root.subsys.su_sem);
+	mutex_unlock(&clusters_root.subsys.su_mutex);
 	if (!found)
 		cm = NULL;
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index 9f5ad0f..48b77d1 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -934,7 +934,7 @@ static int __init init_o2nm(void)
 		goto out_sysctl;
-	init_MUTEX(&o2nm_cluster_group.cs_subsys.su_sem);
+	mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
 	ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys);
 	if (ret) {
 		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index bbb1b6c..5ce0fc4 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -40,9 +40,9 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/kref.h>
+#include <linux/mutex.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
@@ -174,7 +174,7 @@ struct configfs_group_operations {
 struct configfs_subsystem {
 	struct config_group	su_group;
-	struct semaphore	su_sem;
+	struct mutex		su_mutex;
 static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)

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

* [git patches] ocfs2 and configfs updates
@ 2006-12-05  0:01 Mark Fasheh
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2006-12-05  0:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, ocfs2-devel, linux-kernel, joel.becker

Hi Linus,

  This patch set comprises the bulk of my 2.6.20 features which need to be
pushed upstream. My description of the changes is below:

* Various ocfs2 cleanups, including a patchset by me intended to clean up
  some of the internal ocfs2 journal api. Mostly this revolves around
  removing the ocfs2_journal_handle wrapper around handle_t. The immediate
  benefits are better readability and a slightly smaller memory footprint
  for open journal transactions.

* Configfs gets some small cleanups and some mutex annotations.

* Atime updates - thanks to Tiger Yang <>, ocfs2 now
  writes to the inode atime field. This doesn't require any disk changes,
  and is completely backwards compatible with older ocfs2 versions. An
  inodes Atime is only updated if it hasn't changed within a certain
  quantum. The user can define their own value at mount time, with 0
  indicating that atime should always be updated. This is very similar to
  the scheme implemented by gfs2.

* Sys_splice - ocfs2 now has splice read and write support. Thanks again to
  Tiger for the bulk of this functionality. Mostly we make use of the
  generic_splice_read() and generic_file_splice_write_nolock() functions
  provided already in fs/splice.c.

 - There is one patch in the ocfs2 splice() series external to fs/ocfs2 - a
   simple export of should_remove_suid(). This is done for code reuse
   purposes. That particular patch can be seen at:

   I'll also attach it to this mail for review purposes.

* Not included in this set of patches are the following updates, which I
  think need a few more days before they're ready (I'll push them early next
  week if they make the cut):

  - A lock migration fix within the ocfs2 dlm.

  - Some patches to make ocfs2 network timeout values user-adjustable.

  - A "local mount" patch which will give ocfs2 the ability to act as a
    local file system (no cluster configuration needed, no dlm locking,

Please pull from 'upstream-linus' branch of
git:// upstream-linus

to receive the following updates:

 fs/configfs/dir.c        |    9 -
 fs/ocfs2/alloc.c         |   90 +++++-------
 fs/ocfs2/alloc.h         |    2 
 fs/ocfs2/aops.c          |   22 +--
 fs/ocfs2/aops.h          |    2 
 fs/ocfs2/dir.c           |   33 ++--
 fs/ocfs2/dir.h           |    2 
 fs/ocfs2/dlm/dlmdomain.c |    3 
 fs/ocfs2/dlmglue.c       |   60 ++++++--
 fs/ocfs2/dlmglue.h       |    9 -
 fs/ocfs2/export.c        |    2 
 fs/ocfs2/file.c          |  343 ++++++++++++++++++++++++++++++++---------------
 fs/ocfs2/file.h          |   11 +
 fs/ocfs2/inode.c         |   33 +---
 fs/ocfs2/inode.h         |    9 -
 fs/ocfs2/ioctl.c         |   10 -
 fs/ocfs2/journal.c       |  271 ++++---------------------------------
 fs/ocfs2/journal.h       |   78 +---------
 fs/ocfs2/localalloc.c    |  126 +++++++----------
 fs/ocfs2/localalloc.h    |    3 
 fs/ocfs2/mmap.c          |   11 +
 fs/ocfs2/namei.c         |  296 +++++++++++++++++++++-------------------
 fs/ocfs2/namei.h         |    2 
 fs/ocfs2/ocfs2.h         |    4 
 fs/ocfs2/suballoc.c      |  174 ++++++++++-------------
 fs/ocfs2/suballoc.h      |   16 --
 fs/ocfs2/super.c         |   32 ++--
 fs/ocfs2/symlink.c       |    4 
 mm/filemap.c             |    1 
 29 files changed, 760 insertions(+), 898 deletions(-)

Adrian Bunk:
      [2.6 patch] make ocfs2_create_new_lock() static
      configfs: make configfs_dirent_exists() static

Mark Fasheh:
      ocfs2: fix format warnings in dlm_alloc_pagevec()
      ocfs2: remove unused ocfs2_journal_handle field
      ocfs2: have ocfs2_extend_trans() take handle_t
      ocfs2: remove ocfs2_journal_handle flags field
      ocfs2: don't pass handle to ocfs2_meta_lock() in localalloc.c
      ocfs2: don't pass handle to ocfs2_meta_lock() in __ocfs2_flush_truncate_log()
      ocfs2: don't pass handle to ocfs2_meta_lock() in ocfs2_mknod()
      ocfs2: don't pass handle to ocfs2_meta_lock() in ocfs2_link()
      ocfs2: don't pass handle to ocfs2_meta_lock() in orphan dir code
      ocfs2: don't pass handle to ocfs2_meta_lock in ocfs2_unlink()
      ocfs2: don't pass handle to ocfs2_meta_lock in ocfs2_symlink()
      ocfs2: don't pass handle to ocfs2_meta_lock in ocfs2_rename()
      ocfs2: don't use handle for locking in allocation functions
      ocfs2: Don't allocate handle early in ocfs2_rename()
      ocfs2: remove unused ocfs2_handle_add_inode()
      ocfs2: remove unused ocfs2_handle_add_lock()
      ocfs2: make ocfs2_alloc_handle() static
      ocfs2: remove unused handle argument from ocfs2_meta_lock_full()
      ocfs2: pass ocfs2_super * into ocfs2_commit_trans()
      ocfs2: remove ocfs2_journal_handle journal field
      ocfs2: remove handle argument to ocfs2_start_trans()
      ocfs2: Remove struct ocfs2_journal_handle in favor of handle_t
      configfs: mutex_lock_nested() fix
      Export should_remove_suid()
      ocfs2: Remove ocfs2_write_should_remove_suid()

Tiger Yang:
      ocfs2: Add splice support
      ocfs2: core atime update functions
      ocfs2: update file system paths to set atime
      ocfs2: implement i_op->permission

From: Mark Fasheh <>
Date: Tue, 17 Oct 2006 17:05:18 -0700
Subject: [PATCH] Export should_remove_suid()

This helps us avoid replicating the same logic within file system drivers.

Signed-off-by: Mark Fasheh <>


 mm/filemap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 7b84dc8..13df01c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1893,6 +1893,7 @@ int should_remove_suid(struct dentry *de
 	return 0;
 int __remove_suid(struct dentry *dentry, int kill)

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

end of thread, other threads:[~2008-01-25 23:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 18:30 [git patches] ocfs2 and configfs updates Mark Fasheh
  -- strict thread matches above, loose matches on Subject: below --
2008-01-25 23:16 Mark Fasheh
2007-07-11 16:22 Mark Fasheh
2006-12-05  0:01 Mark Fasheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).