question on your MOUNT_REWRITE changes.

Tigran Aivazian (tigran@alancoxonachip.com)
Fri, 14 Apr 2000 15:48:55 +0100 (BST)


Hi Al,

The "exchange dentries" code in sys_chdir()/chroot() used to look like
this:

tmp = current->fs->pwd;
current->fs->pwd = dentry;
dput(tmp);

so, I used it in my function:

void move_task_pwd(struct task *p, struct dentry *where)
{
struct dentry *tmp;

tmp = p->fs->pwd;
p->fs->pwd = dget(where);
dput(tmp);
}

(the race with namei that may be using current->fs->pwd on some other CPU
is overcome by making sure that while move_task_pwd() is called 'p'
can't be running on any CPU).

So, with your recent changes, I assume my move_task_pwd() should look
like this:

void move_task_pwd(struct task *p, struct dentry *where)
{
struct dentry *tmp;
struct vfsmount *tmp_mnt;

tmp_mnt = p->fs->pwdmnt;
tmp = p->fs->pwd;
p->fs->pwd = dget(where);
p->fs->pwdmnt = ???? /* mntget(what?) */
dput(tmp);
mntput(tmp_mnt);
}

i.e. how do I get 'struct vfsmount' by given 'dentry *where'?

My guess is that I can't. Instead I should have kept 'struct file'
corresponding to 'where' and used f_vfsmnt - is this correct? (assuming
that 'where' is always a mountpoint)

Thanks for your help,

Tigran.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/