mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
Detect change in underlying mounted disks (#7229)
This commit is contained in:
parent
e098852a80
commit
6dd26b8231
17
cmd/posix.go
17
cmd/posix.go
@ -73,6 +73,7 @@ type posix struct {
|
|||||||
diskMount bool // indicates if the path is an actual mount.
|
diskMount bool // indicates if the path is an actual mount.
|
||||||
driveSync bool // indicates if the backend is synchronous.
|
driveSync bool // indicates if the backend is synchronous.
|
||||||
|
|
||||||
|
diskFileInfo os.FileInfo
|
||||||
// Disk usage metrics
|
// Disk usage metrics
|
||||||
stopUsageCh chan struct{}
|
stopUsageCh chan struct{}
|
||||||
}
|
}
|
||||||
@ -177,7 +178,10 @@ func newPosix(path string) (*posix, error) {
|
|||||||
if path, err = getValidPath(path); err != nil {
|
if path, err = getValidPath(path); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
fi, err := os.Stat(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
p := &posix{
|
p := &posix{
|
||||||
connected: true,
|
connected: true,
|
||||||
diskPath: path,
|
diskPath: path,
|
||||||
@ -188,8 +192,9 @@ func newPosix(path string) (*posix, error) {
|
|||||||
return &b
|
return &b
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
stopUsageCh: make(chan struct{}),
|
stopUsageCh: make(chan struct{}),
|
||||||
diskMount: mountinfo.IsLikelyMountPoint(path),
|
diskFileInfo: fi,
|
||||||
|
diskMount: mountinfo.IsLikelyMountPoint(path),
|
||||||
}
|
}
|
||||||
|
|
||||||
var pf BoolFlag
|
var pf BoolFlag
|
||||||
@ -351,7 +356,7 @@ func (s *posix) checkDiskFound() (err error) {
|
|||||||
if !s.IsOnline() {
|
if !s.IsOnline() {
|
||||||
return errDiskNotFound
|
return errDiskNotFound
|
||||||
}
|
}
|
||||||
_, err = os.Stat(s.diskPath)
|
fi, err := os.Stat(s.diskPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case os.IsNotExist(err):
|
case os.IsNotExist(err):
|
||||||
@ -364,6 +369,10 @@ func (s *posix) checkDiskFound() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !os.SameFile(s.diskFileInfo, fi) {
|
||||||
|
s.connected = false
|
||||||
|
return errDiskNotFound
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user