All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pvcreate: check the label after writing
@ 2014-09-25  2:20 Lidong Zhong
  2014-09-25  7:52 ` Zdenek Kabelac
  0 siblings, 1 reply; 4+ messages in thread
From: Lidong Zhong @ 2014-09-25  2:20 UTC (permalink / raw)
  To: lvm-devel

Some device will place metadata area at the beginning part and writing
label may fail.Take our test for example, when running pvcreate on a CDL
formatted DASD device(without partition), it shows successfully create
a pv, but the label is not written on the second sector and pvs shows
nothing. Although it is not supposed to run lvm on dasd device, it's a
friendly behavior to check the label and return error if it fails.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
---
 lib/label/label.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/label/label.c b/lib/label/label.c
index ce59da8..4867ede 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -295,6 +295,7 @@ int label_write(struct device *dev, struct label *label)
 {
 	char buf[LABEL_SIZE] __attribute__((aligned(8)));
 	struct label_header *lh = (struct label_header *) buf;
+	uint64_t sector;
 	int r = 1;
 
 	if (!label->labeller->ops->write) {
@@ -331,6 +332,9 @@ int label_write(struct device *dev, struct label *label)
 		r = 0;
 	}
 
+	if (!_find_labeller(dev,buf,&sector,0))
+		r = 0;
+
 	if (!dev_close(dev))
 		stack;
 
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-26  3:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25  2:20 [PATCH] pvcreate: check the label after writing Lidong Zhong
2014-09-25  7:52 ` Zdenek Kabelac
2014-09-25  8:37   ` Zdenek Kabelac
2014-09-26  3:21     ` Lidong Zhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.