Skip to contentSkip to conversation

Multiple lower layers - presedence?

DISCUSSION Fabian Sturm 4 participants 5 messages Jan 5, 2015 – Jan 8, 2015

lore
Share & tools
lore
#0 lore raw

The current documentation states the following:

Multiple lower layers
---------------------

Multiple lower layers can now be given using the the colon (":") as a separator character between the directory names. For example:

mount -t overlay overlay -olowerdir=/lower1:/lower2:/lower3 /merged

As the example shows, "upperdir=" and "workdir=" may be omitted. In that case
the overlay will be read-only.

Consider the case /lower1/A and /lower2/A exist.
What is part of the api - that it is undefined or that one takes presedence over the other?
It would be nice to have this clarified in the documentation.

Thanks,
Fabian

#1 lore raw

The current documentation of overlayfs states the following:

Multiple lower layers
---------------------

Multiple lower layers can now be given using the the colon (":") as a separator character between the directory names. For example:

mount -t overlay overlay -olowerdir=/lower1:/lower2:/lower3 /merged

As the example shows, "upperdir=" and "workdir=" may be omitted. In that case
the overlay will be read-only.

Consider the case /lower1/A and /lower2/A exist.
What is part of the api - that it is undefined or that one takes presedence over the other?
It would be nice to have this clarified in the documentation.

Thanks,
Fabian

#2 lore raw

Hi,

Fabian Sturm wrote (05 Jan 2015 01:29:04 GMT) :

Quoted 4 lines

Consider the case /lower1/A and /lower2/A exist.
What is part of the api - that it is undefined or that one takes presedence over the other?
It would be nice to have this clarified in the documentation.

IMO this should be specified. I would intuitively believe that a right-hand lowerdir should take precedence over any left-hand one, but my intuition definitely is tainted by cultural background that not everyone shares, so it's probably worth looking at how it's done in aufs, to make migration easier for aufs users.

Cheers,
--
intrigeri

#3 lore raw
Quoted 8 lines · intrigeri

Hi,

Fabian Sturm wrote (05 Jan 2015 01:29:04 GMT) :

Quoted 4 lines

Consider the case /lower1/A and /lower2/A exist.
What is part of the api - that it is undefined or that one takes presedence over the other?
It would be nice to have this clarified in the documentation.

Quoted 5 lines

IMO this should be specified. I would intuitively believe that a right-hand lowerdir should take precedence over any left-hand one, but my intuition definitely is tainted by cultural background that not everyone shares, so it's probably worth looking at how it's done in aufs, to make migration easier for aufs users.

Hi,

It seems different in overlayfs. A left-hand lowerdir take precedence over any right-hand one in the option line.

For example, we have two file with same name in two lower directories.

/mnt/ext4/lower1 # echo lower1 > file
/mnt/ext4/lower2 # echo lower2 > file

and mount them in different order.

/mnt # mount -t overlay overlay -o lowerdir=./ext4/lower1/:./ext4/lower2/ ./overlay /mnt # cat ./overlay/file
lower1

/mnt # mount -t overlay overlay -o lowerdir=./ext4/lower2/:./ext4/lower1/ ./overlay /mnt # cat ./overlay/file
lower2

It is because lowerdirs are store in a buffer which is scanned by mount function of overlayfs from left to right. The left most one is treat as the top most lowerdir and the right most lowerdir is treat as the lowest lowerdir.

I think a definition about this is needed in the documentation.

Thanks,
Hu

#4 lore raw
Quoted 2 lines · hujianyang

It seems different in overlayfs. A left-hand lowerdir take precedence over any right-hand one in the option line.

Documentation added.

Thanks,
Miklos