[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061115155205.GA3911@infradead.org>
Date: Wed, 15 Nov 2006 15:52:05 +0000
From: Christoph Hellwig <hch@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: torvalds@...l.org, akpm@...l.org, sds@...ho.nsa.gov,
trond.myklebust@....uio.no, selinux@...ho.nsa.gov,
linux-kernel@...r.kernel.org, aviro@...hat.com, steved@...hat.com
Subject: Re: [PATCH 19/19] CacheFiles: Permit daemon to probe inuseness of a cache file
On Tue, Nov 14, 2006 at 08:07:02PM +0000, David Howells wrote:
> Permit the daemon to probe to see whether a cache file is in use by a netfs or
> not.
>
> Signed-Off-By: David Howells <dhowells@...hat.com>
> ---
>
> fs/cachefiles/cf-daemon.c | 73 +++++++++++++++++++
> fs/cachefiles/cf-namei.c | 170 +++++++++++++++++++++++++++++++++++++++++++++
> fs/cachefiles/internal.h | 3 +
> 3 files changed, 246 insertions(+), 0 deletions(-)
>
> diff --git a/fs/cachefiles/cf-daemon.c b/fs/cachefiles/cf-daemon.c
> index ae82685..ee07865 100644
> --- a/fs/cachefiles/cf-daemon.c
> +++ b/fs/cachefiles/cf-daemon.c
> @@ -38,6 +38,7 @@ static int cachefiles_daemon_cull(struct
> static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args);
> static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args);
> static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args);
> +static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args);
>
> static unsigned long cachefiles_open;
>
> @@ -66,6 +67,7 @@ static const struct cachefiles_daemon_cm
> { "frun", cachefiles_daemon_frun },
> { "fcull", cachefiles_daemon_fcull },
> { "fstop", cachefiles_daemon_fstop },
> + { "inuse", cachefiles_daemon_inuse },
> { "tag", cachefiles_daemon_tag },
> { "", NULL }
> };
> @@ -602,3 +604,74 @@ inval:
> kerror("debug command requires mask");
> return -EINVAL;
> }
> +
> +/*
> + * find out whether an object is in use or not
> + * - command: "inuse <dirfd> <name>"
> + */
> +static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args)
> +{
> + struct dentry *dir;
> + struct file *dirfile;
> + uid_t fsuid;
> + gid_t fsgid;
> + u32 fscreatesid;
> + int dirfd, fput_needed, ret;
> +
> + _enter(",%s", args);
> +
> + dirfd = simple_strtoul(args, &args, 0);
> +
> + if (!isspace(*args))
> + goto inval;
> +
> + while (isspace(*args))
> + args++;
> +
> + if (!*args)
> + goto inval;
> +
> + if (strchr(args, '/'))
> + goto inval;
> +
> + if (!test_bit(CACHEFILES_READY, &cache->flags)) {
> + kerror("inuse applied to unready cache");
> + return -EIO;
> + }
> +
> + if (test_bit(CACHEFILES_DEAD, &cache->flags)) {
> + kerror("inuse applied to dead cache");
> + return -EIO;
> + }
> +
> + /* extract the directory dentry from the fd */
> + dirfile = fget_light(dirfd, &fput_needed);
Once again a very strong NACK for anything that gets a fd argument as
text from userspace. Also a very strong NACK for use of fget/fget_light
from non-core code and exports for either of them.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists