[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200711192218.GGB69793.VOQtMLFFOSHOJF@I-love.SAKURA.ne.jp>
Date: Mon, 19 Nov 2007 22:18:24 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: hch@...radead.org, trond.myklebust@....uio.no
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [TOMOYO #5 02/18] Add wrapper functions for VFS helper functions.
Hello.
Christoph Hellwig wrote:
> > NACK to this. Passing function parameters through the task_struct is
> > definitely not an acceptable hack
> Exactly. Having a vfsmount other than the current processes root or
> current working directory in task_struct doesn't make any sense.
The process's root and cwd vfsmounts are used permanently, but
this last_vfsmount passed via task_struct behaves like temporary variable
pushed on stack memory.
In other words, last_vfsmount becomes NULL when it becomes invalid.
| static inline int vfs_create2(struct inode *dir, struct dentry *dentry,
| int mode, struct nameidata *nd)
| {
| int ret;
| struct vfsmount *mnt = nd ? nd->path.mnt : NULL;
| struct task_struct *task = current;
| struct vfsmount *prev_mnt = task->last_vfsmount;
| task->last_vfsmount = mntget(mnt);
| ret = vfs_create(dir, dentry, mode, nd);
| task->last_vfsmount = prev_mnt;
| mntput(mnt);
| return ret;
| }
I agree that keeping last_vfsmount after it lost it's reference count is bad, but
I don't understand why keeping last_vfsmount while it has it's reference count is bad too.
Regards.
-
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