On Tue, Sep 13, 2022 at 11:54 AM Amir Goldstein <amir73il@xxxxxxxxx> wrote: > OK. IIUC, you have upper fs files only in the root dir? Sorry, no, the upper fs files need to be in subdir. > And the lower root dir has only subdirs? There could be files. > Can you give a small example of an upper a lower and their > union trees just for the sake of discussion? > For example, assume lower has the following layout: $ tree lower . └── A ├── B │ └── lower └── lower I can't create files in the fs in the lower. $ touch A/B/file touch: cannot touch 'A/B/file': Permission denied The upper is initially empty. I would like to overlay a writable fs on top of lower, so the union tree looks like $ tree union . └── A ├── B │ └── lower └── lower $ touch A/B/file $ tree union . └── A ├── B │ ├── file │ └── lower2 └── lower1 Here, 'file' exists in the upper. Further, directory B could disappear from lower. When that happens, I think there are two possible behaviors: - make 'file' disappear from union as well; - make 'file' and its directory accessible as well. In behavior 1, it will look like $ tree union . └── A └── lower1 In behavior 2, it will look like $ tree union . └── A ├── B │ └── file └── lower1 IMHO, behavior 1 works better in my use case. But if the FS experts think behavior 2 makes more sense, I can work around. > > If that is all then it sounds pretty simple. > It could be described something like this: > 1. merged directories cannot appear/disappear > 2. lower pure directories can appear/disappear > 3. upper files/dirs can be created inside merge dirs and pure upper dirs > > I think I have some patches that could help with #2. > These three semantics looks good to me. > Thanks, > Amir.