Regarding Wrapfs Code - function wrapfs_interpose
Hello All,
I want to find out the purpose of a part of Wrapfs code.
The function name is wrapfs_interpose
The code is
/* check that the lower file system didn't cross a mount point */
if (lower_inode->i_sb != SUPERBLOCK_TO_LOWER(sb)) {
err = -EXDEV;
goto out;
}I want to find out what is the purpose of the above check.
Thanks,
Uzair Lakhnai
Karachi, Pakistan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 9 lines · UZAIR LAKHANI
I want to find out the purpose of a part of Wrapfs code.
The function name is
wrapfs_interposeThe code is
/* check that the lower file system didn't cross a mount point */
Quoted 7 lines
if (lower_inode->i_sb != SUPERBLOCK_TO_LOWER(sb)) { err = -EXDEV; goto out; }I want to find out what is the purpose of the above check.
Exactly what the comment says - it checks to make sure that we didn't cross a mount point. It does this by making sure that the lower-level superblock of this lower-level inode is the same as the lower-level superblock that we expect (the one used at mount-time). So basically, if we see a superblock that is different from the one we usually use, we crossed a mount point and so we return an error.
Avishay Traeger
http://www.fsl.cs.sunysb.edu/~avishay/
Quoted 25 lines · Avishay Traeger
Quoted 9 lines · UZAIR LAKHANI
I want to find out the purpose of a part of Wrapfs code.
The function name is
wrapfs_interposeThe code is
/* check that the lower file system didn't cross a mount point */
Quoted 7 lines
if (lower_inode->i_sb != SUPERBLOCK_TO_LOWER(sb)) { err = -EXDEV; goto out; }I want to find out what is the purpose of the above check.
Exactly what the comment says - it checks to make sure that we didn't cross a mount point. It does this by making sure that the lower-level superblock of this lower-level inode is the same as the lower-level superblock that we expect (the one used at mount-time). So basically, if we see a superblock that is different from the one we usually use, we crossed a mount point and so we return an error.
Quoted 2 lines
Avishay Traeger
http://www.fsl.cs.sunysb.edu/~avishay/
More detail.
In its default mode, Wrapfs generates inode numbers by inheriting the inum of the lower inode: that way we are guaranteed unique inodes, and a fast operation to generate inodes. But if you cross into a new sb, you could clash with other inodes that have the same inum (confusing the icache) -- so the default alg doesn't work unless we prohibit you from crossing into lower sb's.
Wrapfs supports therefore another mode in which we use iunique() to generate unique inums. In this mode you *can* cross into new sb's, but the disadvantage now is that your inums are not persistent (this can mess up certain tools like tar/find, and NFS).
In Unionfs we implemented yet another alternative (called "imap" or Inode Map). We generate unique inums, but we store them persistently on the lower f/s, in a special mapping file. That way we can map our own stacked inums to the lower ones. So this allows you to cross into any number of sb's, and it works with NFS (client/server) and with tools like tar and find. Problem is, performance now suffers each time you have to consult the i-mapping file to translate b/t upper and lower inums.
Erez.