📄 readme.attach
字号:
# -*- text -*- GENERAL INFORMATION ON NEW FIST ATTACH MODEWARNING: this code is alpha quality at best! Only the bare-bone featuresare implemented: much is missing and no serious error checking is done. Itis currently supported only on Linux 2.4 and tested only with Wrapfs.* ProblemWhen you mount a stackable file system, you stack it on top of anotherdirectory. That mount can only be done by the root user, because the VFSchecks that before it calls your file system code.There are cases where you'd like to stack a file system on top of multipledirectories. For example, suppose you wanted to use Cryptfs to encryptseveral users' directories. If you wanted to encrypt the entire set of homedirectories, you could stack Cryptfs on top of /home. But what if you donot want to encrypt all of /home, but only portions of it, say/home/ezk/priv and /home/ion/Mail/personal? You would have to mount Cryptfstwice, one for each of those directories. Now imagine hundreds of userswanting each to have a personal crypto directory, and you can see whyhundreds of mounts are impractical (and also impossible, as most kernelshave hard limits on the maximum allowed number of mounts).Another, even more serious problem with Cryptfs is when trying to supportmultiple user keys. Current Cryptfs supports only one keys. If you changethe code to support multiple keys (per UID, per GID, per UID+SID) as manyhave done, you find serious name clashes. For example two users withgroup-access to the same directory can create the same file "foo", whichencrypts to different ciphertext names; so it's allowed on the lower-levelfile system, but cannot be allowed inside Cryptfs. Such and other oddsemantics are due to the fact that current Cryptfs has a shared name space.The new attach mode will allow Cryptfs to separate the name spaces, thusimproving security and avoiding name clashes and odd semantics.* SolutionOur solution is called "attach-mode mount." You enable it in your .fistfile with the declaration "mntstyle attach." In this mode, you mount a verythin stackable file system on top of a given mount point, and you do NOTspecify at mount-time which directory you're going to stack on. Instead,that specification comes later.Once you mount a stackable file system in attach-mode, you get an emptydirectory. Now you can run fist_ioctl to execute the new "attach" ioctlwhich will allow you to attach a new directory node right below thestackable file system mount point, and have that new node point to yourpersonal directory.(BTW, this attach-style mount is not new. Matt Blaze did something similarfor CFS, only in a user-level file server.)* Examplesroot# mount -t wrapfs -o debug=18 none /mnt/wrapfsezk$ fist_ioctl +a /mnt/wrapfs zadok /home/ezk/privion$ fist_ioctl +a /mnt/wrapfs badula /home/ion/Mail/personal and so on...The above sequence of commands will result in having two new directoryentries inside /mnt/wrapfs:$ ls -a /mnt/wrapfs. .. badula zadokThe actions of attach and detach are very similar to mount and unmount,respectively -- only that the attach/detach ioctls do not require rootprivileges.You can use "fist_ioctl -a" to detach a node (may not be implemented yet).* ImplementationThe exact details of this code are in the Linux-2.4 FiST template. Look forsections of code delimited by #ifdef FIST_MNTSTYLE_ATTACH. Briefly, whenyou mount Wrapfs in attach mode, it uses a different set of VFS ops (iops,dops, fops, etc.) than the normal stacking code. There is no "hidden"superblock, dentry, or inode at mount time. The only real operationpossible at this point is the attach ioctl. This one will create a newvirtual dentry as a child of the mount point, and set its hidden dentry tothe one that the user pointed to. From that point on, we're using theregular stacking code and VFS operations.Happy attaching,Erez.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -