Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 5, 2013 at 4:56 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> I'd probably just do this, and to hell with helper functions...
>
> int d_set_mounted(struct dentry *dentry)
> {
>         struct dentry *p;
>         int ret = 0;
>         write_seqlock(&rename_lock);
>         for (p = dentry; !IS_ROOT(p); p = p->d_parent) {
>                 /* Need exclusion wrt. check_submounts_and_drop() */
>                 spin_lock(&p->d_lock);
>                 if (unlikely(d_unhashed(p))) {
>                         spin_unlock(&p->d_lock);
>                         ret = -ENOENT;
>                         goto out;
>                 }
>                 spin_unlock(&p->d_lock);
>         }
>         spin_lock(&dentry->d_lock);
>         dentry->d_flags |= DCACHE_MOUNTED;
>         spin_unlock(&dentry->d_lock);
> out:
>         write_sequnlock(&rename_lock);
>         return ret;
> }

One issue with that: the dentry should be checked and marked within
the same d_locked region.   Because e.g. d_invalidate() relies solely
on d_lock for non-dir mounts and d_mountpoint() checking, no
rename_lock protection there.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux