Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
| ... | ... |
@@ -540,8 +540,14 @@ func xfsSupported() error {
|
| 540 | 540 |
return err // error text is descriptive enough |
| 541 | 541 |
} |
| 542 | 542 |
|
| 543 |
- // Check if kernel supports xfs filesystem or not. |
|
| 544 |
- exec.Command("modprobe", "xfs").Run()
|
|
| 543 |
+ mountTarget, err := ioutil.TempDir("", "supportsXFS")
|
|
| 544 |
+ if err != nil {
|
|
| 545 |
+ return errors.Wrapf(err, "error checking for xfs support") |
|
| 546 |
+ } |
|
| 547 |
+ |
|
| 548 |
+ /* The mounting will fail--after the module has been loaded.*/ |
|
| 549 |
+ defer os.RemoveAll(mountTarget) |
|
| 550 |
+ unix.Mount("none", mountTarget, "xfs", 0, "")
|
|
| 545 | 551 |
|
| 546 | 552 |
f, err := os.Open("/proc/filesystems")
|
| 547 | 553 |
if err != nil {
|
| ... | ... |
@@ -8,7 +8,6 @@ import ( |
| 8 | 8 |
"io" |
| 9 | 9 |
"io/ioutil" |
| 10 | 10 |
"os" |
| 11 |
- "os/exec" |
|
| 12 | 11 |
"path" |
| 13 | 12 |
"path/filepath" |
| 14 | 13 |
"strconv" |
| ... | ... |
@@ -201,9 +200,15 @@ func parseOptions(options []string) (*overlayOptions, error) {
|
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 | 203 |
func supportsOverlay() error {
|
| 204 |
- // We can try to modprobe overlay first before looking at |
|
| 205 |
- // proc/filesystems for when overlay is supported |
|
| 206 |
- exec.Command("modprobe", "overlay").Run()
|
|
| 204 |
+ // Access overlay filesystem so that Linux loads it (if possible). |
|
| 205 |
+ mountTarget, err := ioutil.TempDir("", "supportsOverlay")
|
|
| 206 |
+ if err != nil {
|
|
| 207 |
+ logrus.WithError(err).WithField("storage-driver", "overlay2").Error("could not create temporary directory, so assuming that 'overlay' is not supported")
|
|
| 208 |
+ return graphdriver.ErrNotSupported |
|
| 209 |
+ } |
|
| 210 |
+ /* The mounting will fail--after the module has been loaded.*/ |
|
| 211 |
+ defer os.RemoveAll(mountTarget) |
|
| 212 |
+ unix.Mount("overlay", mountTarget, "overlay", 0, "")
|
|
| 207 | 213 |
|
| 208 | 214 |
f, err := os.Open("/proc/filesystems")
|
| 209 | 215 |
if err != nil {
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"io" |
| 11 | 11 |
"io/ioutil" |
| 12 | 12 |
"os" |
| 13 |
- "os/exec" |
|
| 14 | 13 |
"path" |
| 15 | 14 |
"path/filepath" |
| 16 | 15 |
"strconv" |
| ... | ... |
@@ -273,9 +272,15 @@ func parseOptions(options []string) (*overlayOptions, error) {
|
| 273 | 273 |
} |
| 274 | 274 |
|
| 275 | 275 |
func supportsOverlay() error {
|
| 276 |
- // We can try to modprobe overlay first before looking at |
|
| 277 |
- // proc/filesystems for when overlay is supported |
|
| 278 |
- exec.Command("modprobe", "overlay").Run()
|
|
| 276 |
+ // Access overlay filesystem so that Linux loads it (if possible). |
|
| 277 |
+ mountTarget, err := ioutil.TempDir("", "supportsOverlay2")
|
|
| 278 |
+ if err != nil {
|
|
| 279 |
+ logrus.WithError(err).WithField("storage-driver", "overlay2").Error("could not create temporary directory, so assuming that 'overlay' is not supported")
|
|
| 280 |
+ return graphdriver.ErrNotSupported |
|
| 281 |
+ } |
|
| 282 |
+ /* The mounting will fail--after the module has been loaded.*/ |
|
| 283 |
+ defer os.RemoveAll(mountTarget) |
|
| 284 |
+ unix.Mount("overlay", mountTarget, "overlay", 0, "")
|
|
| 279 | 285 |
|
| 280 | 286 |
f, err := os.Open("/proc/filesystems")
|
| 281 | 287 |
if err != nil {
|