Re: [patch 1/2] vfsmount_lock

Andrew Morton
2003-05-21T09:19:47Z

Maneesh Soni <maneesh@in.ibm.com> wrote:
>
> struct vfsmount *lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
> {
> struct list_head * head = mount_hashtable + hash(mnt, dentry);
> struct list_head * tmp = head;
> - struct vfsmount *p;
> + struct vfsmount *p, *found = NULL;
>
> + spin_lock(&vfsmount_lock);
> for (;;) {
> tmp = tmp->next;
> p = NULL;
> if (tmp == head)
> break;
> p = list_entry(tmp, struct vfsmount, mnt_hash);
> - if (p->mnt_parent == mnt && p->mnt_mountpoint == dentry)
> + if (p->mnt_parent == mnt && p->mnt_mountpoint == dentry) {
> + found = mntget(p);
> break;
> + }
> }
> - return p;
> + spin_lock(&vfsmount_lock);
> + return found;
> }

err, how many times do you want to spin that lock?