[PATCH] [LIO-Target/ConfigFS]: Add lio_target_port_check_link()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings all,

This patch adds struct configfs_item_operations->check_link() for
lio_target_port_item_ops that allows existing LIO-Target Port Logical Unit
ACL to prevent an unlink(2) from a exported target_core_mod/ConfigFS
Linux storage object at:

/sys/kernel/config/target/iscsi/$TARGET_IQN/$TPGT/lun/$LUN/$PORT

when iSCSI Initiator LUN ACLs exist to LIO-Target/ConfigFS storage
objects in:

/sys/kernel/config/target/iscsi/$IQN/$TPGT/acl/$INITIATOR_IQN/$LUN

These patches are made against lio-core-2.6.git/master and tested on
v2.6.29 x86 32-bit HVM.  The lio-core-2.6.git tree can be found at: 

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=summary

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/lio-core/iscsi_target_configfs.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/lio-core/iscsi_target_configfs.c b/drivers/lio-core/iscsi_target_configfs.c
index dc6ef88..acaa436 100644
--- a/drivers/lio-core/iscsi_target_configfs.c
+++ b/drivers/lio-core/iscsi_target_configfs.c
@@ -523,6 +523,13 @@ out:
 	return(ret);
 }
 
+static int lio_target_port_check_link(struct config_item *lun_ci)
+{
+	se_lun_t *lun = container_of(to_config_group(lun_ci), se_lun_t, lun_group);
+
+	return atomic_read(&lun->lun_acl_count) ? -EACCES : 0;
+}
+
 static int lio_target_port_unlink (struct config_item *lun_ci, struct config_item *se_dev_ci)
 {
 	iscsi_portal_group_t *tpg;
@@ -568,6 +575,7 @@ static struct configfs_item_operations lio_target_port_item_ops = {
 	.show_attribute		= lio_target_port_show,
 	.store_attribute	= lio_target_port_store,
 	.allow_link		= lio_target_port_link,
+	.check_link		= lio_target_port_check_link,
 	.drop_link		= lio_target_port_unlink,
 };
 
-- 
1.5.4.1



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux