浏览代码

Merge pull request #20003 from liubogithub/btrfs

Graphdriver/btrfs: Avoid using single d.Get()
Brian Goff 9 年之前
父节点
当前提交
25941b5020
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      daemon/graphdriver/btrfs/btrfs.go

+ 5 - 1
daemon/graphdriver/btrfs/btrfs.go

@@ -256,10 +256,14 @@ func (d *Driver) Create(id, parent, mountLabel string) error {
 			return err
 		}
 	} else {
-		parentDir, err := d.Get(parent, "")
+		parentDir := d.subvolumesDirID(parent)
+		st, err := os.Stat(parentDir)
 		if err != nil {
 			return err
 		}
+		if !st.IsDir() {
+			return fmt.Errorf("%s: not a direcotory", parentDir)
+		}
 		if err := subvolSnapshot(parentDir, subvolumes, id); err != nil {
 			return err
 		}