From 06e7562fd94a162be4229cfc1505cf6bacf29402 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 17 Jan 2012 11:41:15 -0800 Subject: [PATCH] filestore: overwrite fsid during --mkfs This mainly matters because read_fsid() now looks at the file size to determine if it's an old- or new-style fsid, and not overwriting mean a downgrade confuses things. Not that anyone would do that, but... Signed-off-by: Sage Weil --- src/os/FileStore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 2f6ebfa8b288c..47223678b2328 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -837,7 +837,7 @@ int FileStore::mkfs() dout(1) << "mkfs in " << basedir << dendl; snprintf(buf, sizeof(buf), "%s/fsid", basedir.c_str()); - fsid_fd = ::open(buf, O_CREAT|O_WRONLY, 0644); + fsid_fd = ::open(buf, O_CREAT|O_WRONLY|O_TRUNC, 0644); if (fsid_fd < 0) { ret = -errno; -- 2.39.5