linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Joel Becker <joel.becker@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] [ConfigFS]: Add struct configfs_item_operations->check_link()
Date: Fri, 3 Apr 2009 11:51:28 +0200	[thread overview]
Message-ID: <20090403095128.GE32106@hawkmoon.kerlabs.com> (raw)
In-Reply-To: <1238747107.4250.448.camel@haakon2.linux-iscsi.org>

[-- Attachment #1: Type: text/plain, Size: 3386 bytes --]

Hi,

On 03/04/09  1:25 -0700, Nicholas A. Bellinger wrote:
> Hi Joel and co,
> 
> This patch adds struct configfs_item_operations->check_link() and
> changes fs/configfs/symlink.c:configfs_unlink() so that
> when (*check_link) is present, an ConfigFS unlink will fail, based upon
> input by said symlinked struct config_item *parent_item.
> 
> If a non zero return is returned from (*check_link), said non zero value is
> expected to use include/asm-generic/errno* values, and the failure is returned
> to userspace via the unlink(2) system call.
> 
> Please consider this patch for v2.6.30.  It requires no changes to existing consumers
> of ConfigFS like fs/ocfs2, and I have tested it with running LIO-Target v3.0 code.
> 
> Many thanks for your most valuable of time,

I can't judge the actual need for that since I don't really know your usecase
(I've seen the second patch). However check_link() without target_item as
parameter looks a bit restrictive for no valuable reason.

See inline for a concern about the error returned.
Other than that, the patch looks ok.

Louis

> 
> --nab
> 
> 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 932a92b..a5dede6 100644
> --- a/fs/configfs/symlink.c
> +++ b/fs/configfs/symlink.c
> @@ -202,6 +202,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 -EACCES here.
> +	 */

I think that -EPERM is more natural than -EACCES. check_link() actually checks
that the operation is permitted.

> +	if (type && type->ct_item_ops &&
> +	    type->ct_item_ops->check_link) {
> +		ret = type->ct_item_ops->check_link(parent_item);
> +		if (ret != 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 7f62777..b026f16 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);
>  	int (*drop_link)(struct config_item *src, struct config_item *target);
>  };
>  
> -- 
> 1.5.4.1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Dr Louis Rilling			Kerlabs
Skype: louis.rilling			Batiment Germanium
Phone: (+33|0) 6 80 89 08 23		80 avenue des Buttes de Coesmes
http://www.kerlabs.com/			35700 Rennes

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-04-03  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03  8:25 [PATCH] [ConfigFS]: Add struct configfs_item_operations->check_link() Nicholas A. Bellinger
2009-04-03  9:51 ` Louis Rilling [this message]
2009-04-03 10:47   ` Nicholas A. Bellinger

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=20090403095128.GE32106@hawkmoon.kerlabs.com \
    --to=louis.rilling@kerlabs.com \
    --cc=akpm@linux-foundation.org \
    --cc=joel.becker@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).