[sheepdog] [PATCH 2/2] sbd: forbid to attach read-only snapshot

Liu Yuan namei.unix at gmail.com
Fri May 30 08:37:18 CEST 2014


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sbd/sheep.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sbd/sheep.c b/sbd/sheep.c
index b1cbbfb..56b6e23 100644
--- a/sbd/sheep.c
+++ b/sbd/sheep.c
@@ -255,6 +255,14 @@ int sheep_setup_vdi(struct sbd_device *dev)
 		pr_err("Cannot read inode for %s, %d\n", dev->vdi.name, ret);
 		goto out_release;
 	}
+
+	if (vdi_is_snapshot(inode)) {
+		pr_err("%s: don't support to add snapshot %s\n", DRV_NAME,
+		       dev->vdi.name);
+		ret = -EINVAL;
+		goto out_release;
+	}
+
 	dev->vdi.inode = inode;
 	pr_info("%s: Associated to %s\n", DRV_NAME, inode->name);
 	return 0;
-- 
1.8.1.2




More information about the sheepdog mailing list