summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2015-12-11 16:06:12 +0100
committerNicholas Bellinger <nab@linux-iscsi.org>2015-12-20 18:04:03 -0800
commitd79d75b5c5182fd94225996db71e06f9cbc7faed (patch)
tree8e0b9def43d58ee4d8775896e683a8128fa7048f /include
parent9a70adfff3379a6511483bd60dac06fda49b14a8 (diff)
downloadop-kernel-dev-d79d75b5c5182fd94225996db71e06f9cbc7faed.zip
op-kernel-dev-d79d75b5c5182fd94225996db71e06f9cbc7faed.tar.gz
fs: configfs: Add unlocked version of configfs_depend_item()
This change is necessary for the SCSI target usb gadget composed with configfs. In this case configfs will be used for two different purposes: to compose a usb gadget and to configure the target part. If an instance of tcm function is created in $CONFIGFS_ROOT/usb_gadget/<gadget>/functions a tpg can be created in $CONFIGFS_ROOT/target/usb_gadget/<wwn>/, but after a tpg is created the tcm function must not be removed until its corresponding tpg is gone. While the configfs_depend/undepend_item() are meant exactly for creating this kind of dependencies, they are not suitable if the other kernel subsystem happens to be another subsystem in configfs, so this patch adds unlocked versions meant for configfs callbacks. Above description has been provided by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> In configfs_depend_item() we have to consider two possible cases: 1) When we are called to depend another item in the same subsystem as caller In this case we should skip locking configfs root as we know that configfs is in valid state and our subsystem will not be unregistered during this call. 2) When we are called to depend item in different subsystem than our caller In this case we are also sure that configfs is in valid state but we have to lock root of configfs to avoid unregistration of target's subsystem. As it is other than caller's subsystem, there may be nothing what protects us against unregistration of that subsystem. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/configfs.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3b5c6d5..7ee1a01 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -213,4 +213,20 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
struct config_item *target);
void configfs_undepend_item(struct config_item *target);
+/*
+ * These functions can sleep and can alloc with GFP_KERNEL
+ * NOTE: These should be called only underneath configfs callbacks.
+ * NOTE: First parameter is a caller's subsystem, not target's.
+ * WARNING: These cannot be called on newly created item
+ * (in make_group()/make_item() callback)
+ */
+int configfs_depend_item_unlocked(struct configfs_subsystem *caller_subsys,
+ struct config_item *target);
+
+
+static inline void configfs_undepend_item_unlocked(struct config_item *target)
+{
+ configfs_undepend_item(target);
+}
+
#endif /* _CONFIGFS_H_ */
OpenPOWER on IntegriCloud