mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad@darnok.org>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: "linux-scsi" <linux-scsi@vger.kernel.org>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	James Bottomley <James.Bottomley@suse.de>,
	Jens Axboe <axboe@kernel.dk>, Boaz Harrosh <bharrosh@panasas.com>
Subject: Re: [RFC 02/22] configfs: Add struct configfs_item_operations->check_link() in configfs_unlink()
Date: Thu, 2 Sep 2010 00:31:07 -0400	[thread overview]
Message-ID: <201009020031.08750.konrad@darnok.org> (raw)
In-Reply-To: <1283160025-6598-1-git-send-email-nab@linux-iscsi.org>

On Monday 30 August 2010 05:20:25 Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch adds a optional struct configfs_item_operations->check_link()
> check called in fs/configfs/symlink.c:configfs_unlink() that can be used by
> configfs consumers to check for an explict struct config_group dependence
> with active symlink and fail with -EPERM before the unlink(2) syscall is
> allowed to occur.
>
> Currently without this patch, there is not a method that a consumer can
> tell configfs_unlink() that it needs to fail for this particular case. 
> Allowing ->check_link() to propigate up the errno to VFS is also another
> option for the call, but currently for TCM using the existing -EPERM in
> configfs_unlink() is fine here.
>
> Note this patch is used by TCM v4 generic configfs fabric module
> infrastructure to allow  explict Initiator Port MappedLUNs symlinks to
> create a dependency for the fabric TPG Port LUNs living in a configfs group
> that is not a direct struct config_group parent.
>
> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> ---
>  fs/configfs/symlink.c    |   13 +++++++++++++
>  include/linux/configfs.h |    1 +
>  2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
> index 0f3eb41..b8010de 100644
> --- a/fs/configfs/symlink.c
> +++ b/fs/configfs/symlink.c
> @@ -205,6 +205,19 @@ int configfs_unlink(struct inode *dir, struct dentry
> *dentry) parent_item = configfs_get_config_item(dentry->d_parent);
>  	type = parent_item->ci_type;
>
> +	/*
> +	 * See if the underlying struct config_item has dependent
> +	 * symlinks, and should return -EPERM here.
> +	 */
> +	if (type && type->ct_item_ops &&
> +	    type->ct_item_ops->check_link) {
> +		if (type->ct_item_ops->check_link(parent_item,
> +					sl->sl_target) != 0) {
> +			config_item_put(parent_item);
> +			goto out;
> +		}
> +	}
> +
>  	spin_lock(&configfs_dirent_lock);
>  	list_del_init(&sd->s_sibling);
>  	spin_unlock(&configfs_dirent_lock);
> diff --git a/include/linux/configfs.h b/include/linux/configfs.h
> index ddb7a97..7c01d86 100644
> --- a/include/linux/configfs.h
> +++ b/include/linux/configfs.h
> @@ -226,6 +226,7 @@ struct configfs_item_operations {
>  	ssize_t	(*show_attribute)(struct config_item *, struct configfs_attribute
> *,char *); ssize_t	(*store_attribute)(struct config_item *,struct
> configfs_attribute *,const char *, size_t); int (*allow_link)(struct
> config_item *src, struct config_item *target); +	int (*check_link)(struct
> config_item *src, struct config_item *target); int (*drop_link)(struct
> config_item *src, struct config_item *target); };

You might want to copy these folks:

git/linux$ scripts/get_maintainer.pl -f fs/configfs/symlink.c
Joel Becker <joel.becker@oracle.com>
Tejun Heo <tj@kernel.org>
Al Viro <viro@zeniv.linux.org.uk>


  reply	other threads:[~2010-09-02  5:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30  9:20 Nicholas A. Bellinger
2010-09-02  4:31 ` Konrad Rzeszutek Wilk [this message]
2010-09-02  6:48   ` Joel Becker
2010-09-02 19:40     ` Nicholas A. Bellinger
2010-09-07 21:01       ` Konrad Rzeszutek Wilk
2010-09-07 22:44         ` Joel Becker
2010-09-08  2:08           ` Nicholas A. Bellinger
2010-09-08 19:26             ` Joel Becker
2010-09-08 20:53               ` Nicholas A. Bellinger
2010-09-10 15:28                 ` Joel Becker
2010-09-10 19:06                   ` Nicholas A. Bellinger
2010-09-10 19:44                     ` Joel Becker
2010-09-10 19:52                       ` Nicholas A. Bellinger
2010-09-20 22:06                         ` Joel Becker
2010-09-22  7:16                           ` Nicholas A. Bellinger
2010-09-22 11:18                             ` Boaz Harrosh
2010-09-22 11:54                               ` Nicholas A. Bellinger
2010-09-23  3:59                             ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201009020031.08750.konrad@darnok.org \
    --to=konrad@darnok.org \
    --cc=James.Bottomley@suse.de \
    --cc=axboe@kernel.dk \
    --cc=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=nab@linux-iscsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®