Name a filesystem by its kernel id, never its device name (hq ADR 0325 fourth review)
An ext4 or xfs library mounted by UUID can come back from a reboot as another device (/dev/sdb1 as /dev/sdc1); naming the filesystem by mountinfo's source read that as a move, stripped the warranted library's entries and asked for a new Approve. A filesystem is now named by statfs's f_fsid (from the UUID, or the ZFS dataset), its type and its mount point. Entries left on the filesystem a folder is on now are merged back or held, never walked away, and a TakenOn naming a mount point is not taken.
This commit is contained in:
@@ -87,14 +87,24 @@ func dropLeft(path string, f store.KeptFolder) []string {
|
||||
if _, err := lstatWithin(path); err == nil {
|
||||
holding = mountHolding(path, MountPoints())
|
||||
}
|
||||
holdingID := ""
|
||||
if holding != "" {
|
||||
holdingID = PlacedID(holding)
|
||||
}
|
||||
var said []string
|
||||
var still []store.KeptLeft
|
||||
var mine []store.KeptUser
|
||||
for _, l := range f.Left {
|
||||
same := l.Mount == f.Mount && (l.Placed == "" || l.Placed == f.Placed)
|
||||
switch {
|
||||
case f.Kept && l.Mount == f.Mount:
|
||||
case f.Kept && same:
|
||||
// Left on the filesystem the folder is kept on now: the folder's own entries.
|
||||
mine = append(mine, l.Users...)
|
||||
case l.Mount != holding:
|
||||
case same:
|
||||
// On the filesystem the folder is on now, not kept yet: never walked away; they are the folder's
|
||||
// once it is kept there again.
|
||||
still = append(still, l)
|
||||
case l.Mount != holding || (l.Placed != "" && l.Placed != holdingID):
|
||||
still = append(still, l)
|
||||
default:
|
||||
drop := map[uint32]bool{}
|
||||
|
||||
Reference in New Issue
Block a user