magic_write was incorrectly using the parent directory's inode to get the
name of the control file.
This patch fixes it.
Also made the error message little more verbose.
Signed-off-by: Chandra Seetharaman <[EMAIL PROTECTED]>
Signed-off-by: Gerrit Huizenga <[EMAIL PROTECTED]>
---------
fs/rcfs/magic.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
Index: linux-2.6.13-ckrm2/fs/rcfs/magic.c
===================================================================
--- linux-2.6.13-ckrm2.orig/fs/rcfs/magic.c 2005-09-09 21:41:36.000000000
-0700
+++ linux-2.6.13-ckrm2/fs/rcfs/magic.c 2005-09-09 21:41:57.000000000 -0700
@@ -154,15 +154,17 @@ static ssize_t
magic_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
- struct rcfs_inode_info *ri =
+ struct rcfs_inode_info *ri_parent =
rcfs_get_inode_info(file->f_dentry->d_parent->d_inode);
+ struct rcfs_inode_info *ri_self =
+ rcfs_get_inode_info(file->f_dentry->d_inode);
char *optbuf, *otherstr=NULL, *resname=NULL;
int done, rc = 0;
struct ckrm_core_class *core ;
int (*func) (struct ckrm_core_class *, const char *,
const char *) = NULL;
- core = ri->core;
+ core = ri_parent->core;
if (!ckrm_is_core_valid(core))
return -EINVAL;
@@ -172,36 +174,38 @@ magic_write(struct file *file, const cha
if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;
- down(&(ri->vfs_inode.i_sem));
+ down(&(ri_parent->vfs_inode.i_sem));
optbuf = kmalloc(MAX_INPUT_SIZE+1, GFP_KERNEL);
if (!optbuf) {
- up(&(ri->vfs_inode.i_sem));
+ up(&(ri_parent->vfs_inode.i_sem));
return -ENOMEM;
}
__copy_from_user(optbuf, buf, count);
mkvalidstr(optbuf);
- done = magic_parse(ri->mfdentry->d_name.name,
+ done = magic_parse(ri_self->mfdentry->d_name.name,
optbuf, &resname, &otherstr);
if (!done) {
- printk(KERN_ERR "Error parsing data written to %s\n",
- ri->mfdentry->d_name.name);
+ printk(KERN_ERR "Error parsing data written to %s/%s\n",
+ file->f_dentry->d_parent->d_name.name,
+ ri_self->mfdentry->d_name.name);
goto out;
}
- if (!strcmp(ri->mfdentry->d_name.name, RCFS_CONFIG_NAME)) {
+ if (!strcmp(ri_self->mfdentry->d_name.name, RCFS_CONFIG_NAME)) {
func = core->classtype->set_config;
- } else if (!strcmp(ri->mfdentry->d_name.name, RCFS_STATS_NAME)) {
+ } else if (!strcmp(ri_self->mfdentry->d_name.name, RCFS_STATS_NAME)) {
func = core->classtype->reset_stats;
}
if (func) {
rc = func(core, resname, otherstr);
if (rc) {
- printk(KERN_ERR "magic_write: %s: error\n",
- ri->mfdentry->d_name.name);
+ printk(KERN_ERR "magic_write: %s/%s: error\n",
+ file->f_dentry->d_parent->d_name.name,
+ ri_self->mfdentry->d_name.name);
}
}
out:
- up(&(ri->vfs_inode.i_sem));
+ up(&(ri_parent->vfs_inode.i_sem));
kfree(optbuf);
kfree(otherstr);
kfree(resname);
--
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech