Re: Question about overlayfs ovl_link

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

 



Robin Dong <hao.bigrat@xxxxxxxxx> writes:

> 在 2012年2月28日 下午4:41,Miklos Szeredi <miklos@xxxxxxxxxx> 写道:
> We have backported the overlayfs to our kernel (2.6.32) and find out
> that when making hard link for a upper file, the kernel will BUG_ON,
> the reason is:
>
> After "ln hello bye" (as the example above and imaging file "hello" is
> an executive program), there are two overlayfs dentries
> point to just one inode. Then we run "./hello", the d_count of "hello"
> dentry become 1 (by __d_lookup), and ovl_permission will try to get
> the alias
> dentry of this inode:
>
>                 alias = list_entry(inode->i_dentry.next,
>                                    struct dentry, d_alias);
>                 dget(alias);
>
> but it will find out "bye" dentry and its d_count is zero (because we
> get the inode from another dentry--"hello").
> It will report BUG_ON when trying to dget a zero d_count dentry in
> 2.6.32 kernel:
>
> static inline struct dentry *dget(struct dentry *dentry)
> {
>         if (dentry) {
>                 BUG_ON(!atomic_read(&dentry->d_count));
>                 atomic_inc(&dentry->d_count);
>         }
>         return dentry;
> }
>
> There are two ways to fix this problem.
> First, traverse all alias of inode to find a non-zero-d_count dentry,
> this may be inefficient
> Second, create a new overlayfs inode and a new overlayfs dentry in
> ovl_link, that will make the result of two actions
> ("create link" then "mount", or "mount" then "create link")
> consistent.

Okay, I understand the problem now.

Creating a new inode in ovl_link might be the better solution here, I
think.

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