aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/configfs.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-06-18 21:06:09 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-07-10 20:18:59 -0400
commit631d1febab8e546e3bb800bdfe2c212b8adf87de (patch)
tree7399384371f3c32a9458907f14ec73c9ccf51d7c /include/linux/configfs.h
parent299894cc9001b09e3e9685f2709b49e7e1092ccc (diff)
configfs: config item dependancies.
Sometimes other drivers depend on particular configfs items. For example, ocfs2 mounts depend on a heartbeat region item. If that region item is removed with rmdir(2), the ocfs2 mount must BUG or go readonly. Not happy. This provides two additional API calls: configfs_depend_item() and configfs_undepend_item(). A client driver can call configfs_depend_item() on an existing item to tell configfs that it is depended on. configfs will then return -EBUSY from rmdir(2) for that item. When the item is no longer depended on, the client driver calls configfs_undepend_item() on it. These API cannot be called underneath any configfs callbacks, as they will conflict. They can block and allocate. A client driver probably shouldn't calling them of its own gumption. Rather it should be providing an API that external subsystems call. How does this work? Imagine the ocfs2 mount process. When it mounts, it asks for a heart region item. This is done via a call into the heartbeat code. Inside the heartbeat code, the region item is looked up. Here, the heartbeat code calls configfs_depend_item(). If it succeeds, then heartbeat knows the region is safe to give to ocfs2. If it fails, it was being torn down anyway, and heartbeat can gracefully pass up an error. [ Fixed some bad whitespace in configfs.txt. --Mark ] Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'include/linux/configfs.h')
-rw-r--r--include/linux/configfs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 8227e730dac7..8c6967f3fb11 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -188,6 +188,11 @@ static inline struct configfs_subsystem *to_configfs_subsystem(struct config_gro
188int configfs_register_subsystem(struct configfs_subsystem *subsys); 188int configfs_register_subsystem(struct configfs_subsystem *subsys);
189void configfs_unregister_subsystem(struct configfs_subsystem *subsys); 189void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
190 190
191/* These functions can sleep and can alloc with GFP_KERNEL */
192/* WARNING: These cannot be called underneath configfs callbacks!! */
193int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
194void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target);
195
191#endif /* __KERNEL__ */ 196#endif /* __KERNEL__ */
192 197
193#endif /* _CONFIGFS_H_ */ 198#endif /* _CONFIGFS_H_ */